Skip to content

tutorial message queueing

Raymond Meester edited this page Sep 16, 2024 · 16 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 types of brokers, namely Classic and Artemis. Both variants are supported. Artemis is the default option in Assimbly and the one we use in this tutorial.

Step 1: Create a broker

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

CreateBroker

  • Add the following queues to the configuration file. Best to place it at the end of the XML, just above </addresses>.
           <address name="TestQ1">
              <anycast>
                 <queue name="TestQ1"/>
              </anycast>
           </address>
           <address name="TestQ2">
              <anycast>
                 <queue name="TestQ2"/>
              </anycast>
           </address>           
  • 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 Source step to "sjms".
  • Change the path to "TestQ1".

SJMSEndpoint

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 SINK step to "sjms".
  • Change the path to "TestQ2".
  • Select the same connection: "EmbeddedBroker".

After the changes, 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