Messaging with Be Informed 3.11 and a Full javascript stack

Geert Liet

Geert Liet

Published: 11 June, 2014

This blogpost is about creating an integration concept with the newest Be Informed version (3.11) and a modern application stack, including React and node.js.

Be Informed is a business process platform which allows for modelling an application instead of coding it, see their website for more information. React is an javascript framework for building user interfaces created by Facebook. Node.js is a javascript application platform. Combining the two works perfectly.

The following setup is used:

 

Be Informed 3.11  - mern

So what does it do? It basically is a chat / communication setup, which allows sending messages from one side tot another. So there are two sides which can send messages and receive messages with the ActiveMQ broker providing the application messaging.

On the react side there is a form and a panel. The panel is able to receive notifications through a web-sockets connection (socket.io) and it shows the last five received notifications:

socket.on('server_message', function(notifications) {
self.addNotification(notifications);
});

All notifications are stored in mongodb (mongojs).
The form part of the application sends a notification on the submit action to the nodejs server:

handleSubmit: function () {
var message = this.refs.message.getDOMNode().value.trim();
var socket = io.connect("http://localhost");

socket.emit('notification_to_bi',message);
}

The nodejs server has a connection with ActiveMQ using STOMP (stomp-client). This connection with ActiveMQ is used to send and receive messages to and from the activemq broker.
On the other side of the broker, Be Informed is listening. The connection is done with the activemq component in camel:

<camel:route id="receiveMessage">
<camel:from uri="activemq:queue:BI.INPUT"/>

   <camel:setHeader headerName="biUserId"><camel:constant>geert</camel:constant></camel:setHeader>
   <camel:setHeader headerName="biPassword"><camel:constant>secret</camel:constant></camel:setHeader>

   <camel:to uri="xslt:bi://JMSTest/Stylesheets/ConvertToBI.xslt"/> 
   <camel:policy ref="headerBasedAuthenticationPolicy">
       <camel:to uri="bean:eventMessageDispatcher?method=onMessage('cmaas', 'receivemessage')" />
   </camel:policy>
</camel:route>

The incoming message is routed to a Be Informed service which is connected to a receive event which stores the received message as a record in the corresponding case.

A simple event and form are created in Be Informed to send a message back to the javascript app, in the event a start camel route handler is used. Sending the message is done with a simple route:

<camel:route id="sendjms">
    <camel:from uri="direct:sendjms"/>
    <wireTap uri="activemq:queue:BEI.QUEUE" />
</camel:route>

So that is basically it. The new features in Be Informed allow for easier and faster integration of the platform, choosing CAMEL is a smart move which opens up tons of possibilities.

Did you enjoy reading?

Share this blog with your audience!