Cloud Connectors in Payara Micro
Originally published on 02 Jun 2017
Last updated on 09 Jun 2017
Payara Micro 172 brings with it support for JCA adapters, meaning it can be used as a client for Java Messaging Service (JMS) brokers. JMS is a Java EE API which provides a common interface for standard communication protocols. This means that you can send and receive messages between systems in a platform and language independent way. With Payara Micro now supporting JMS, you can setup your Micro instance as a JMS client with Message Driven Beans (MDBs) to listen and respond to messages from other systems through a message broker.
What is a Message Broker?
Traditional message brokers were made to solve the problem of having multiple applications that need to act on data from multiple different data sources in a standard way. Without a message broker, you could well end up with a network looking like this:
Having a message broker makes it look more like this:
The message broker allows you to decouple your messaging from your application code and communicate between systems in a language agnostic way.
Message brokers typically follow a publish-subscribe pattern. This means that all messages received are stored in sections called topics. Producers send messages to the broker by publishing to this topic. The data in the message can be stored in any format depending on your needs. Consumers will then receive messages by subscribing to a particular topic. They will receive all messages from that topic. Consumers can subscribe to any number of topics, and handle each topic depending on the application needs.
Using Message Brokers With Payara Micro
Payara Micro isn't packaged with a message broker. This means that Payara Micro stays lightweight, and allows you to integrate your application with an external message broker. You could, for example, dedicate a cluster of Payara Servers to be a message broker. This would mean that the message broker is more highly available. To integrate Payara Micro with these external message brokers, you need to include and deploy a Java Connector Architecture (JCA) adapter. While any valid JMS RAR file will allow you to connect to a JMS broker, the Cloud Connectors suite includes some examples of JCA adapters for non-JMS message brokers.
Currently we have JCA adapters for:
- Apache Kafka - sending messages using a Connection Factory and receiving messages via an MDB.
- Amazon SQS - sending messages using a Connection Factory and receiving messages via an MDB to Amazon Simple Queue Service queues.
- MQTT - sending messages using a Connection Factory and receiving messages via an MDB to an MQTT broker or to IOT hubs that support MQTT.
- Azure Service Bus - Sending and receiving messages to/from Azure Service Bus Queues using ConnectionFactory via MDB.
In future blogs ( see the list below) we will explore these different messaging platforms as well as sample projects using these adapters.
Related Posts
A More Flexible Way to Deploy Jakarta EE Apps: Introducing Pay As You Go Pricing for Payara Cloud
Published on 05 Dec 2024
by Luqman Saeed
0 Comments
The Payara Monthly Catch - November 2024
Published on 28 Nov 2024
by Chiara Civardi
0 Comments