Skip to content

Instantly share code, notes, and snippets.

@ayeshLK
Created May 21, 2024 07:39
Show Gist options
  • Save ayeshLK/8dbafa5e2f80b5870dd09891db883e03 to your computer and use it in GitHub Desktop.
Save ayeshLK/8dbafa5e2f80b5870dd09891db883e03 to your computer and use it in GitHub Desktop.
import ballerinax/activemq.driver as _;
import ballerinax/java.jms;
public function main() returns error? {
jms:Connection connection = check new (
initialContextFactory = "org.apache.activemq.jndi.ActiveMQInitialContextFactory",
providerUrl = "tcp://localhost:61616"
);
jms:Session session = check connection->createSession();
jms:MessageProducer queueProducer = check session.createProducer({
'type: jms:QUEUE,
name: "test-queue"
});
jms:TextMessage message = {
content: "This is a sample message"
};
check queueProducer->send(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment