JMS in Martini
Martini Server Runtime supports JMS messaging, it offers multiple ways to list broker destinations and send messages using the Martini CLI, API Explorer, and Martini Designer.
Warning
It's important to acknowledge that the RabbitMQ JMS client currently does not offer a full implementation of the JMS API. However, it can be integrated with JMS systems by using a bridge or plugin, such as RabbitMQ's JMS Client or by converting JMS to AMQP. These tools allow you to receive JMS messages in a RabbitMQ environment by mapping JMS concepts (e.g., topics, queues) to RabbitMQ equivalents. This partial support may lead to connection issues or messages not being delivered as expected. Given these constraints, Martini defaults to utilizing an in-memory broker for handling WebSocket messages, thereby excluding RabbitMQ from WebSocket message routing.
List Destinations
List destinations using Martini CLI
- Open the Runtime Directory:
<martini-home>/bin
- Run the Martini Server Runtime in debug mode:
1 |
|
- Launch the Martini CLI:
1 |
|
- Connect to your Martini Server Runtime instance.
1 |
|
- Use the command to list available destinations:
1 |
|
List destinations using API Explorer
- Open a web browser and navigate to
[HOST]:8080/api-explorer/
to access the API Explorer. - Locate and click on the
broker
tag within the API Explorer to view various broker configuration and operation endpoints. - Use the
/esbapi/broker/destinations
endpoint found under thebroker
tag to list available destinations. - Execute the request using the
GET
method at the/esbapi/broker/destinations
endpoint.
Sending Messages
Send messages using Martini CLI
- Open the Runtime Directory:
<martini-home>/bin
- Run the Martini Server Runtime in debug mode:
1 |
|
- Launch the Martini CLI:
1 |
|
- Connect to your Martini Server Runtime instance.
1 |
|
- Use the command
publish-string
orpublish-file
: -
To publish a string, which will send a
string
to the consumer:1
publish-sting --destination [URI] --value [STRING]
-
To publish a file, which will send a
file
to the consumer:1
publish-file --destination [URI] --file [PATH] --media-type [TYPE]
URI can be queue://[name]
or topic://[name]
.
Send messages using API Explorer
- Open a web browser and navigate to
[HOST]:8080/api-explorer/
to access the API Explorer. - Locate and click on the
broker
tag within the API Explorer to view various broker configuration and operation endpoints. - Choose a endpoint and type you want to use for sending messages:
- To publish a
string
, use/esbapi/broker/destinations/{type}/{name}/sendString
. - To publish
bytes
, use/esbapi/broker/destinations/{type}/{name}/sendBytes
. - To publish an
object
, use/esbapi/broker/destinations/{type}/{name}/sendObject
.
!!! warning
Sending objects to a RabbitMQ Queue will only work if the amqp parameter is set to false
.
- For the
type
field, you can typequeue
ortopic
based on your needs. For thename
field, specify the destination name you want to send to. - Execute the request using the
POST
method at the chosen endpoint.
Using Martini Designer
To list destinations and send messages using Martini Designer refer to the developing documentation here.