Skip to content

tutorial v3 message queueing

Raymond Meester edited this page Mar 17, 2023 · 2 revisions

In this tutorial you learn how to create a flow with message queueing. We use the flow created in the Quick Start again.

Introduction

Assimbly can connect to several brokers for example to ActiveMQ, RabbitMQ or Kafka.These components all acts as clients. Assimbly also has the option to run ActiveMQ embedded in the gateway. In this way Assimbly hosts the broker.

ActiveMQ has two variants, namely Classic and Artemis. When Artemis reaches same functionality as classic it will replace it. Both variants are supported by Assimbly. Artemis is the default option in Assimbly and the one we use in this tutorial.

Step 1: Create a broker

  • Go to Broker --> Manage.
  • Click on "Create Broker".
  • Give the broker the name "TestBroker".
  • Leave all other options default

CreateBroker

  • Add the following queues to the configuration file. Best to place it at the end of the XML, just above </core>.
        <addresses>
           <address name="TestQ1">
              <anycast>
                 <queue name="TestQ1"/>
              </anycast>
           </address>
           <address name="TestQ2">
              <anycast>
                 <queue name="TestQ2"/>
              </anycast>
           </address>           
        </addresses>
  • Save the broker.
  • Start the broker. Like a flow the broker is started when it turns green.

Tip: Click on the ActiveMQ or Assimbly logo to go to the online documentation.

Step 2: Clone flow

  • Go to the flows page.
  • Like in tutorial1 clone the 'TestFlow'.

CloneFlow

Step 3: Configure the flow

  • Give the flow the name 'Queues'.
  • Change the component of the From endpoint to "sjms".
  • Change the path to "TestQ1".

ConfigureFromEndpoint

Notice that the from endpoint stays red. This because a connection is required.

Now create a new connection:

  • Click on the '+' button of Connection.
  • Give the connection the name 'EmbeddedBroker'.
    • URL=tcp://localhost:61616
    • Username=admin
    • Password=admin
  • Choose as JMS Provider: "ActiveMQ Artemis".
  • Save the connection

The username/password are the default one. You can change them when editing the broker file.

CreateService

  • Change the component of the To endpoint to "sjms".
  • Change the path to "TestQ2".
  • Select the same connection: "EmbeddedBroker".

After the changes you can save the flow

Step 4: Test the broker and flow

  • Start the flow "Queues".
  • Go to Broker --> Queues.
  • Choose the action "Send" on queue "TestQ1".
  • Paste the following XML into the body:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:Add>
         <tem:intA>2</tem:intA>
         <tem:intB>2</tem:intB>
      </tem:Add>
   </soapenv:Body>
</soapenv:Envelope>
  • Choose Actions "Send and Return".

SendMessage

As a result the messages will be moved from "TestQ1" to "TestQ2". You can browse the "TestQ2" to see the content.

Sending messages from one queue to another queue is not a common use case. Most use cases will have a queue or topic as endpoint while the other endpoint has another protocol, like JBDC, FILE and so on. The broker will then act as a buffer and transport layer.


Now you completed this tutorial. You can continue to the next tutorial with an example of calling a REST API.

Clone this wiki locally