Creating a Message

Before you can send a message via the Message Bus, you must first create it. Here’s how to create a message:

  1. Call the Message constructor to create a new Message:

    Message message = new Message();
  2. Populate the message with a String or Object payload:

    • String payload: message.setPayload("Message Bus is great!")

    • Object payload: message.put("firstName", "Joe")

  3. To receive responses at a particular location, set both of these attributes:

    • Response destination name: setResponseDestinationName(String)

    • Response ID: setResponseId(String)

Sending a Message

Sending Messages Across a Cluster

Using the Message Bus

« Registering Message ListenersSending a Message »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0