Skip to content

Toro Cloud Dev Center


Sending a JMS message

The Java Message Service (JMS) API is a Java message-oriented API for sending messages between applications. On the surface, JMS behaves like a simple producer-consumer; i.e. there are things that create messages (the producer), and there are things that receives those messages (the consumer). This page will show you some of the many ways you can easily send a JMS message.

Using Functions

The JMS class offers various functions for sending JMS messages. This example will use the publishTo(String, String) function:

Sample Gloop service showing how to the `publishTo(String, String)` function

1
2
// Send 'helloworld' string to JMS queue 'com.toro.hello.HelloQueue'
'helloworld'.publishTo('queue://com.toro.hello.HelloQueue')

Using the user interface

There are various ways of sending JMS messages in Martini Desktop and Online. These are features intended for use during development, useful when testing the consumption of JMS messages (e.g., by the JMS listener endpoint). You can send JMS messages from the following parts of Martini:

From the package configuration editor

The package configuration editor has a Send Message button under the JMS Queues/Topics section that allows you to send a JMS message to the selected JMS queue/topic.

Send Message button from package configuration editor

Send Message button from package configuration editor

The image below demonstrates how to send a JMS message using this method:

Sending a JMS message using package configuration editor's Send Message button

Sending a JMS message using package configuration editor's Send Message button

From the instance context menu

From the Navigator, you can right click on an instance, and then select Send JMS Message to send a JMS message to the JMS queue/topic of your choice.

Send JMS Message, as shown from the instance context menu

Send JMS message from the Navigator

The image below demonstrates how to send a JMS message using this method:

Send JMS message using the navigator demo

Send JMS message using the navigator demo

From the JMS listener endpoint context menu

You can also right click a JMS listener endpoint from the Navigator, and then select Send JMS Message from the appearing context menu in order to send a JMS message to the configured destination of the endpoint.

Send JMS message using JMS listener endpoint navigator

Send JMS message using JMS listener endpoint navigator

The image below demonstrates how to send a JMS message using this method:

Send JMS message using JMS listener endpoint navigator demo

Send JMS message using JMS listener endpoint navigator demo

From the JMS listener endpoint editor

The JMS listener endpoint editor also has a Send Message button next to the Destination text field. You can use this button to send a JMS message to the configured destination of the endpoint.

Send JMS message using JMS listener endpoint editor

Send JMS message using JMS listener endpoint editor

Where is the button?

The Send Message button can only be seen when the endpoint has started.

The image below demonstrates how to send a JMS message using this method:

Send JMS message using JMS listener endpoint editor demo

Send JMS message using JMS listener endpoint editor demo