Skip to content

abu-abraham/ActiveMQ-Connection-in-Java

Repository files navigation

An ETL Pipeline using Active-MQ

This repo contains files which to receive data from KEPServer or any other OPC-UA protocol and then publish it to ActiveMQ using MQTT and JMS protocols.

Subscription from OPC-UA can be implemented mostly by using the same examples provided in the eclipse-milo project. Following it, we can quickly recive the subscribed values in the subscription-callback function. Now, to connect to ActiveMQ I referred to eclipse-paho.

ActiveMQ provides a variety of different messaging patterns. While queues and topics are the most famous ones, virtual topics can combine the best of both worlds: multiple consumers with their own dedicated queue. You can see this in OutputHandler.java

Configuration

Server, client certificates and keystores can be generated using the following commands.

  1. Create a keystore for the broker SERVER
keytool -genkey -alias amq-server -keyalg RSA -keysize 2048 -validity 90 -keystore amq-server.ks
  1. Export the broker SERVER certificate from the keystore

    keytool -export -alias amq-server -keystore amq-server.ks -file amq-server_cert

  2. Create the CLIENT keystore

    keytool -genkey -alias amq-client -keyalg RSA -keysize 2048 -validity 90 -keystore amq-client.ks

  3. Import the previous exported broker's certificate into a CLIENT truststore

    keytool -import -alias amq-server -keystore amq-client.ts -file amq-server_cert

  4. If you want to make trusted also the client, you must export the client's certificate from the keystore

    keytool -export -alias amq-client -keystore amq-client.ks -file amq-client_cert

  5. Import the client's exported certificate into a broker SERVER truststore

    keytool -import -alias amq-client -keystore amq-server.ts -file amq-client_cert

To see whether the correct keystore is attached, ie clients key in servers store and vice versa, use the command.

 keytool -list -keystore amq-client.ks 
 keytool -list -keystore amq-server.ts 

and similarly,

 keytool -list -keystore amq-client.ts 
 keytool -list -keystore amq-server.ks 

Once this is done, we can connect to the port 8883 (default, can change in activeMQ.xml file). I have provided a function using MQTT protocol, which is widely used for lightweight message transport and one using the Java Message Service Protocol.

**To access the ActiveMQ webclient, make sure that useJmx="false" is removed from the apache.xml.

About

Connecting Java application to activeMQ, with MQTT protocol.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages