SlideShare a Scribd company logo
Using the JMS 2.0 API with Apache
Pulsar
Enrico Olivelli
DataStax - Luna Streaming Team
Member of Apache Pulsar, Apache BookKeeper and Apache ZooKeeper PMC,
Apache Curator VP
Agenda
● Introduction to the Java Messaging Service API
● Benefits of Apache Pulsar for JMS/JavaEE applications
● Mapping JMS to Pulsar
● Code samples: standard Java code
● Live Demo using EJBs and Apache TomEE®
2
Java Messaging Service API - Messaging for JavaEE
3
JMS is a set of simple API to interact with Messaging Systems:
- Produce and Consume Messages
- Manage Subscriptions
- Transactions
JDBC
JMS
SQL Database
Messaging
System
Java Messaging Service API - Core Concepts
4
JMS Concepts:
- Destinations: Queues and Topics
- Messages
- Producers and Consumers
- Connections and Sessions (JMSContext in 2.0)
Destination
Queue/Topi
c
Producer
Producer
Consumer
Consumer
Consumer
Producer
Send Message
Receive
Message
Java Messaging Service API - Destinations and clients
5
Destinations:
- Queue:
- Each message is received by one Consumer
- Browseable
- Topic:
- Multiple subscriptions
- Messages dispatched according to the Subscription Type
Consumer styles:
- Blocking receive() method, Application driven (no “async” receive)
- MessageListener method, JMS Driver driven
Producer styles:
- Blocking send() method
- Asynchronous send() with CompletionListener
Java Messaging Service API - Administrative operations
6
JMS does not cover administrative operations:
- Manage destinations
- Manage Connection properties
- Define Security Model
- Define Resource Limits
- Configure Quality of Service
The API deals only with Administered Objects:
- Destinations: Queue and Topic references
- ConnectionFactory: The “client” that allows you to connect to the system
Java Messaging Service API - interactions with JavaEE
7
In a JavaEE application you use Enterprise Java Beans (EJB) components
- Stateful/Stateless EJBs, used in:
- WebServlets
- WebServices (JAX-RS/JAX-WS endpoints)
- Background tasks (@Schedule)
- MessageDriven beans
- Activated by the container when receiving a message from a
Connector
The JavaEE container provides support for :
- Lifecycle management/pooling
- Context Dependency Injection (CDI)
- Transactions support
- Standard APIs to interact with the rest of the system
Java Messaging Service API - ResourceAdapters
8
You can extend a JavaEE container using ResourceAdapters (RA).
Key points:
- Deploy a .rar file that contains the code
- Configure the RA
- Allow you to create Administered objects that conform to standard
APIs, implemented by the core in the RA:
- javax.jms.ConnectionFactory
- javax.jms.Queue
- javax.jms.Topic
- Usually such objects are bound in a JNDI registry provided by the
container
How to deploy the .rar file and how to create the Objects is still specific to
the container.
Apache Pulsar - benefits for a JavaEE application
9
● Blazing performance: Millions of JMS messages with low latency.
● Horizontal scalability and object storage offloading: You can scale up or down
compute and storage independently.
● Consolidation: You can consolidate JMS applications spread across multiple
legacy JMS brokers onto a single Pulsar installation.
● Message replay: Applications to travel back in time and replay previously
consumed messages to recover from misconfiguration issues, recover from
bugs in application code, and test new applications against real data.
● Geo-replication: You can easily replicate your messages to other locations for
disaster recovery or global distribution.
● Future readiness: Support traditional messaging workloads, but you also log
collection, microservices integration, event streaming, and event sourcing.
Apache Pulsar - Basic Architecture
10
Bookies (scalable storage)
Brokers (stateless)
ZooKeeper
(metadata)
Proxy
(optional)
Pulsar Functions Workers Pulsar IO Connectors
Python
Producers
JMS
Go
C++
Java
Python
Consumers
JMS
Go
C++
Java
Cassandra
Enterprise
Services
Elastic
Search
Every component is
Horizontally Scalable
Dynamic
addition/removal of
components without
service interruption
GCS
S3
Object Storage
Apache Pulsar - Topics and Subscriptions
11
Unified Model for Messaging:
- Topics:
- Persistent/Non-Persistent
- Partitioned/Non-Partitioned
- Tenants and Namespaces:
- Logical and physical isolation of resources
- Fine grained configuration (topic/namespace/tenant/system
levels)
- Subscription modes:
- Exclusive, Failover, Shared, Key Shared
- Subscription types:
- Durable, Non-Durable
- Producer modes:
- Normal, Exclusive
Mapping the Pulsar to the JMS Model
12
JMS Concepts can be easily mapped to the Pulsar Model:
- JMS Topic -> Pulsar topic
- JMS Queue -> Pulsar topic with only one “shared” durable subscription
- JMS Message -> Pulsar Message
Consumer types:
- Consumer -> Pulsar Exclusive Non-Durable Subscription with unknown name
- DurableConsumer -> Pulsar Exclusive Durable Subscription
- DurableSubscriber -> Pulsar Exclusive Durable Subscription
- SharedConsumer -> Pulsar Shared Non-Durable Subscription
- SharedDurableConsumer -> Pulsar Shared Durable Subscription
No need for additional Proxies or Pulsar protocol handlers
The mapping is managed automatically on the JMS Client library
Connect to Pulsar using the JMS API from JavaSE
13
Steps to connect to Pulsar using the JMS API in a JavaSE application:
# step 1: create the ConnectionFactory (this is the only Pulsar specific code)
Map<String, Object> configuration = new HashMap<>();
configuration.put("webServiceUrl", "http://localhost:8080");
configuration.put("brokerServiceUrl", "pulsar://localhost:6650");
ConnectionFactory factory = new PulsarConnectionFactory(configuration);
# step 2: write and read some message
try (JMSContext context = factory.createContext()) {
Destination destination = context.createQueue("test");
context.createProducer().send(destination, "text");
try (JMSConsumer consumer = context.createConsumer(destination)) {
String message = consumer.receiveBody(String.class);
...
Live Demo - Producer Code - JavaEE - Singleton EJB
14
This is a simple EJB that send a JMS TextMessage using the JMSContext API
# Producer application
@Singleton
public class Timer {
@Resource(name = "pulsar-javax.jms.ConnectionFactory")
ConnectionFactory factory;
@Resource(lookup = "openejb:Resource/FooQueue")
Queue queue;
@Schedule(....)
public void send() {
try (JMSContext context = factory.createContext()) {
context.createProducer().send(queue, “test”);
}
Provided by the container
Live Demo - Consumer code - JavaEE - MessageDriver
bean
15
This is a simple EJB that consumes messages from a Pulsar Topic.
Messages are acknowledged automatically in case of successful processing.
# Consumer application
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName="destination",
propertyValue="lookup://openejb:Resource/FooQueue") })
public class JMSListener implements MessageListener {
public void onMessage(final Message message) {
String contents = message.getBody(String.class);
System.out.println("Received message '" contents
+ "' from destination " + message.getJMSDestination());
}
Provided by the container
Live Demo - Apache TomEE configuration
16
In Apache TomEE you can define the configuration for the Pulsar Resource Adapter and create the FooQueue resource
# conf/system.properties
# deploy the RA (Resource Adapter)
ra = new://Deployments?jar=rars/pulsarra.rar
# binding with a Pulsar cluster is decided by the Administrator
pulsarRA.Configuration = {"brokerServiceUrl":"pulsar://localhost:6650",
"webServiceUrl":"http://localhost:8080"}
# configure the queue (logical JNDI name is openejb:Resource/FooQueue)
FooQueue=new://Resource?type=javax.jms.Queue
# binding with the Physical queue foo-queue is decided by the Administrator
FooQueue.destination=foo-queue
Live demo
17
JavaEE container:
- Using Apache TomEE 8.0.6
- Deploy the Pulsar Resource Adapter (Fast JMS for Pulsar)
- https://github.com/datastax/pulsar-jms/tree/master/resource-adapter
- Create an Administered Object (a javax.jms.Queue)
Applications:
- One application with a @MessageDriver EJB that Consumes a Pulsar topic as a JMSQueue
- One application with a @Singleton EJB that produces messages
- Run Pulsar on local machine or on Free Astra Streaming Hosted account
Live Demo
https://github.com/eolivelli/pulsar-jms-examples
Wrapping up
18
Java Messaging Service API and JavaEE:
- JMS is for Messaging Systems what JDBC is for Databases
- You can easily switch between from one JMS vendor to another
- The ResourceAdapter allows the container to Connect to external systems
- Configuration and Administration is container specific
Apache Pulsar:
- Pulsar is a Cloud Native Messaging System with built-in Multi-Tenancy and GeoReplication
- Pulsar components are horizontally scalable, with cold data offloading
- Pulsar is open source, with a vibrant community - no vendor lock-in
- It very easy to switch to Pulsar if you are already using JMS
Using Pulsar in a Java/JavaEE application via JMS is easy:
- Use the JMS Driver and connect from your Java program
- Deploy the Resource Adapter to integrate with your JavaEE® or JakartaEE® server
- Fast JMS for Apache Pulsar is Open Source and ready to use out-of-the-box
References
19
LinkedIn - linkedin.com/in/enrico-olivelli-984b7874/
Twitter: twitter.com/eolivelli
Apache Pulsar Community: pulsar.apache.org/en/contact/ (Slack, ML…)
References:
Apache Pulsar: github.com/apache/pulsar (ASLv2)
Fast JMS for Apache Pulsar - github.com/datastax/pulsar-jms (ASLv2)
Jakarta JMS 2.0 speficifications - jakarta.ee/specifications/messaging/2.0/
Thank you !
20
We are hiring: https://www.datastax.com/company/careers

More Related Content

What's hot

The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural StyleRobert Wilson
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
Integration Patterns for Microservices Architectures
Integration Patterns for Microservices ArchitecturesIntegration Patterns for Microservices Architectures
Integration Patterns for Microservices ArchitecturesNATS
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site ScriptingAli Mattash
 
MyBatis, une alternative à JPA.
MyBatis, une alternative à JPA.MyBatis, une alternative à JPA.
MyBatis, une alternative à JPA.Kokou Gaglo
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Barrel Software
 
Padrões essenciais de mensageria para integração de sistemas
Padrões essenciais de mensageria para integração de sistemasPadrões essenciais de mensageria para integração de sistemas
Padrões essenciais de mensageria para integração de sistemasHelder da Rocha
 
Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash CourseHaim Michael
 
Introduction to Basic Concepts in Web
Introduction to Basic Concepts in WebIntroduction to Basic Concepts in Web
Introduction to Basic Concepts in WebJussi Pohjolainen
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Amit Tyagi
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http responseNuha Noor
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsi krishna
 
Introduction to rest.li
Introduction to rest.liIntroduction to rest.li
Introduction to rest.liJoe Betz
 

What's hot (20)

Express node js
Express node jsExpress node js
Express node js
 
Http
HttpHttp
Http
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
Integration Patterns for Microservices Architectures
Integration Patterns for Microservices ArchitecturesIntegration Patterns for Microservices Architectures
Integration Patterns for Microservices Architectures
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site Scripting
 
Json web token
Json web tokenJson web token
Json web token
 
MyBatis, une alternative à JPA.
MyBatis, une alternative à JPA.MyBatis, une alternative à JPA.
MyBatis, une alternative à JPA.
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Node.js Express Framework
Node.js Express FrameworkNode.js Express Framework
Node.js Express Framework
 
Padrões essenciais de mensageria para integração de sistemas
Padrões essenciais de mensageria para integração de sistemasPadrões essenciais de mensageria para integração de sistemas
Padrões essenciais de mensageria para integração de sistemas
 
Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash Course
 
Introduction to Basic Concepts in Web
Introduction to Basic Concepts in WebIntroduction to Basic Concepts in Web
Introduction to Basic Concepts in Web
 
webworkers
webworkerswebworkers
webworkers
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
Introduction to rest.li
Introduction to rest.liIntroduction to rest.li
Introduction to rest.li
 
JSON WEB TOKEN
JSON WEB TOKENJSON WEB TOKEN
JSON WEB TOKEN
 

Similar to Using the JMS 2.0 API with Apache Pulsar - Pulsar Virtual Summit Europe 2021

Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroOndrej Mihályi
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroPayara
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroPayara
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technologyMinal Maniar
 
Nitesh_Sr._Java_developer_Lead
Nitesh_Sr._Java_developer_Lead Nitesh_Sr._Java_developer_Lead
Nitesh_Sr._Java_developer_Lead Nitesh Dasari
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEQAware GmbH
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEMario-Leander Reimer
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration TestingSam Brannen
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC vipin kumar
 
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...Juarez Junior
 
Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014Jagadish Prasath
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache TomcatAuwal Amshi
 

Similar to Using the JMS 2.0 API with Apache Pulsar - Pulsar Virtual Summit Europe 2021 (20)

Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Riding with camel
Riding with camelRiding with camel
Riding with camel
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
bjhbj
bjhbjbjhbj
bjhbj
 
Nitesh_Sr._Java_developer_Lead
Nitesh_Sr._Java_developer_Lead Nitesh_Sr._Java_developer_Lead
Nitesh_Sr._Java_developer_Lead
 
Jsp Comparison
 Jsp Comparison Jsp Comparison
Jsp Comparison
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration Testing
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC
 
Jsp and jstl
Jsp and jstlJsp and jstl
Jsp and jstl
 
NodeJS @ ACS
NodeJS @ ACSNodeJS @ ACS
NodeJS @ ACS
 
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
 
Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache Tomcat
 

More from StreamNative

Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022StreamNative
 
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...StreamNative
 
Blue-green deploys with Pulsar & Envoy in an event-driven microservice ecosys...
Blue-green deploys with Pulsar & Envoy in an event-driven microservice ecosys...Blue-green deploys with Pulsar & Envoy in an event-driven microservice ecosys...
Blue-green deploys with Pulsar & Envoy in an event-driven microservice ecosys...StreamNative
 
Distributed Database Design Decisions to Support High Performance Event Strea...
Distributed Database Design Decisions to Support High Performance Event Strea...Distributed Database Design Decisions to Support High Performance Event Strea...
Distributed Database Design Decisions to Support High Performance Event Strea...StreamNative
 
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022StreamNative
 
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022StreamNative
 
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...StreamNative
 
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...StreamNative
 
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022StreamNative
 
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...StreamNative
 
Understanding Broker Load Balancing - Pulsar Summit SF 2022
Understanding Broker Load Balancing - Pulsar Summit SF 2022Understanding Broker Load Balancing - Pulsar Summit SF 2022
Understanding Broker Load Balancing - Pulsar Summit SF 2022StreamNative
 
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...StreamNative
 
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022StreamNative
 
Event-Driven Applications Done Right - Pulsar Summit SF 2022
Event-Driven Applications Done Right - Pulsar Summit SF 2022Event-Driven Applications Done Right - Pulsar Summit SF 2022
Event-Driven Applications Done Right - Pulsar Summit SF 2022StreamNative
 
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022StreamNative
 
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022StreamNative
 
Beam + Pulsar: Powerful Stream Processing at Scale - Pulsar Summit SF 2022
Beam + Pulsar: Powerful Stream Processing at Scale - Pulsar Summit SF 2022Beam + Pulsar: Powerful Stream Processing at Scale - Pulsar Summit SF 2022
Beam + Pulsar: Powerful Stream Processing at Scale - Pulsar Summit SF 2022StreamNative
 
Welcome and Opening Remarks - Pulsar Summit SF 2022
Welcome and Opening Remarks - Pulsar Summit SF 2022Welcome and Opening Remarks - Pulsar Summit SF 2022
Welcome and Opening Remarks - Pulsar Summit SF 2022StreamNative
 
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...StreamNative
 
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...StreamNative
 

More from StreamNative (20)

Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
 
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
 
Blue-green deploys with Pulsar & Envoy in an event-driven microservice ecosys...
Blue-green deploys with Pulsar & Envoy in an event-driven microservice ecosys...Blue-green deploys with Pulsar & Envoy in an event-driven microservice ecosys...
Blue-green deploys with Pulsar & Envoy in an event-driven microservice ecosys...
 
Distributed Database Design Decisions to Support High Performance Event Strea...
Distributed Database Design Decisions to Support High Performance Event Strea...Distributed Database Design Decisions to Support High Performance Event Strea...
Distributed Database Design Decisions to Support High Performance Event Strea...
 
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
 
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
 
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
 
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
 
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
 
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
 
Understanding Broker Load Balancing - Pulsar Summit SF 2022
Understanding Broker Load Balancing - Pulsar Summit SF 2022Understanding Broker Load Balancing - Pulsar Summit SF 2022
Understanding Broker Load Balancing - Pulsar Summit SF 2022
 
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
 
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
 
Event-Driven Applications Done Right - Pulsar Summit SF 2022
Event-Driven Applications Done Right - Pulsar Summit SF 2022Event-Driven Applications Done Right - Pulsar Summit SF 2022
Event-Driven Applications Done Right - Pulsar Summit SF 2022
 
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
 
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
 
Beam + Pulsar: Powerful Stream Processing at Scale - Pulsar Summit SF 2022
Beam + Pulsar: Powerful Stream Processing at Scale - Pulsar Summit SF 2022Beam + Pulsar: Powerful Stream Processing at Scale - Pulsar Summit SF 2022
Beam + Pulsar: Powerful Stream Processing at Scale - Pulsar Summit SF 2022
 
Welcome and Opening Remarks - Pulsar Summit SF 2022
Welcome and Opening Remarks - Pulsar Summit SF 2022Welcome and Opening Remarks - Pulsar Summit SF 2022
Welcome and Opening Remarks - Pulsar Summit SF 2022
 
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
 
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
 

Recently uploaded

In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...Sri Ambati
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesThousandEyes
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationZilliz
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...Product School
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀DianaGray10
 

Recently uploaded (20)

In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 

Using the JMS 2.0 API with Apache Pulsar - Pulsar Virtual Summit Europe 2021

  • 1. Using the JMS 2.0 API with Apache Pulsar Enrico Olivelli DataStax - Luna Streaming Team Member of Apache Pulsar, Apache BookKeeper and Apache ZooKeeper PMC, Apache Curator VP
  • 2. Agenda ● Introduction to the Java Messaging Service API ● Benefits of Apache Pulsar for JMS/JavaEE applications ● Mapping JMS to Pulsar ● Code samples: standard Java code ● Live Demo using EJBs and Apache TomEE® 2
  • 3. Java Messaging Service API - Messaging for JavaEE 3 JMS is a set of simple API to interact with Messaging Systems: - Produce and Consume Messages - Manage Subscriptions - Transactions JDBC JMS SQL Database Messaging System
  • 4. Java Messaging Service API - Core Concepts 4 JMS Concepts: - Destinations: Queues and Topics - Messages - Producers and Consumers - Connections and Sessions (JMSContext in 2.0) Destination Queue/Topi c Producer Producer Consumer Consumer Consumer Producer Send Message Receive Message
  • 5. Java Messaging Service API - Destinations and clients 5 Destinations: - Queue: - Each message is received by one Consumer - Browseable - Topic: - Multiple subscriptions - Messages dispatched according to the Subscription Type Consumer styles: - Blocking receive() method, Application driven (no “async” receive) - MessageListener method, JMS Driver driven Producer styles: - Blocking send() method - Asynchronous send() with CompletionListener
  • 6. Java Messaging Service API - Administrative operations 6 JMS does not cover administrative operations: - Manage destinations - Manage Connection properties - Define Security Model - Define Resource Limits - Configure Quality of Service The API deals only with Administered Objects: - Destinations: Queue and Topic references - ConnectionFactory: The “client” that allows you to connect to the system
  • 7. Java Messaging Service API - interactions with JavaEE 7 In a JavaEE application you use Enterprise Java Beans (EJB) components - Stateful/Stateless EJBs, used in: - WebServlets - WebServices (JAX-RS/JAX-WS endpoints) - Background tasks (@Schedule) - MessageDriven beans - Activated by the container when receiving a message from a Connector The JavaEE container provides support for : - Lifecycle management/pooling - Context Dependency Injection (CDI) - Transactions support - Standard APIs to interact with the rest of the system
  • 8. Java Messaging Service API - ResourceAdapters 8 You can extend a JavaEE container using ResourceAdapters (RA). Key points: - Deploy a .rar file that contains the code - Configure the RA - Allow you to create Administered objects that conform to standard APIs, implemented by the core in the RA: - javax.jms.ConnectionFactory - javax.jms.Queue - javax.jms.Topic - Usually such objects are bound in a JNDI registry provided by the container How to deploy the .rar file and how to create the Objects is still specific to the container.
  • 9. Apache Pulsar - benefits for a JavaEE application 9 ● Blazing performance: Millions of JMS messages with low latency. ● Horizontal scalability and object storage offloading: You can scale up or down compute and storage independently. ● Consolidation: You can consolidate JMS applications spread across multiple legacy JMS brokers onto a single Pulsar installation. ● Message replay: Applications to travel back in time and replay previously consumed messages to recover from misconfiguration issues, recover from bugs in application code, and test new applications against real data. ● Geo-replication: You can easily replicate your messages to other locations for disaster recovery or global distribution. ● Future readiness: Support traditional messaging workloads, but you also log collection, microservices integration, event streaming, and event sourcing.
  • 10. Apache Pulsar - Basic Architecture 10 Bookies (scalable storage) Brokers (stateless) ZooKeeper (metadata) Proxy (optional) Pulsar Functions Workers Pulsar IO Connectors Python Producers JMS Go C++ Java Python Consumers JMS Go C++ Java Cassandra Enterprise Services Elastic Search Every component is Horizontally Scalable Dynamic addition/removal of components without service interruption GCS S3 Object Storage
  • 11. Apache Pulsar - Topics and Subscriptions 11 Unified Model for Messaging: - Topics: - Persistent/Non-Persistent - Partitioned/Non-Partitioned - Tenants and Namespaces: - Logical and physical isolation of resources - Fine grained configuration (topic/namespace/tenant/system levels) - Subscription modes: - Exclusive, Failover, Shared, Key Shared - Subscription types: - Durable, Non-Durable - Producer modes: - Normal, Exclusive
  • 12. Mapping the Pulsar to the JMS Model 12 JMS Concepts can be easily mapped to the Pulsar Model: - JMS Topic -> Pulsar topic - JMS Queue -> Pulsar topic with only one “shared” durable subscription - JMS Message -> Pulsar Message Consumer types: - Consumer -> Pulsar Exclusive Non-Durable Subscription with unknown name - DurableConsumer -> Pulsar Exclusive Durable Subscription - DurableSubscriber -> Pulsar Exclusive Durable Subscription - SharedConsumer -> Pulsar Shared Non-Durable Subscription - SharedDurableConsumer -> Pulsar Shared Durable Subscription No need for additional Proxies or Pulsar protocol handlers The mapping is managed automatically on the JMS Client library
  • 13. Connect to Pulsar using the JMS API from JavaSE 13 Steps to connect to Pulsar using the JMS API in a JavaSE application: # step 1: create the ConnectionFactory (this is the only Pulsar specific code) Map<String, Object> configuration = new HashMap<>(); configuration.put("webServiceUrl", "http://localhost:8080"); configuration.put("brokerServiceUrl", "pulsar://localhost:6650"); ConnectionFactory factory = new PulsarConnectionFactory(configuration); # step 2: write and read some message try (JMSContext context = factory.createContext()) { Destination destination = context.createQueue("test"); context.createProducer().send(destination, "text"); try (JMSConsumer consumer = context.createConsumer(destination)) { String message = consumer.receiveBody(String.class); ...
  • 14. Live Demo - Producer Code - JavaEE - Singleton EJB 14 This is a simple EJB that send a JMS TextMessage using the JMSContext API # Producer application @Singleton public class Timer { @Resource(name = "pulsar-javax.jms.ConnectionFactory") ConnectionFactory factory; @Resource(lookup = "openejb:Resource/FooQueue") Queue queue; @Schedule(....) public void send() { try (JMSContext context = factory.createContext()) { context.createProducer().send(queue, “test”); } Provided by the container
  • 15. Live Demo - Consumer code - JavaEE - MessageDriver bean 15 This is a simple EJB that consumes messages from a Pulsar Topic. Messages are acknowledged automatically in case of successful processing. # Consumer application @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName="destination", propertyValue="lookup://openejb:Resource/FooQueue") }) public class JMSListener implements MessageListener { public void onMessage(final Message message) { String contents = message.getBody(String.class); System.out.println("Received message '" contents + "' from destination " + message.getJMSDestination()); } Provided by the container
  • 16. Live Demo - Apache TomEE configuration 16 In Apache TomEE you can define the configuration for the Pulsar Resource Adapter and create the FooQueue resource # conf/system.properties # deploy the RA (Resource Adapter) ra = new://Deployments?jar=rars/pulsarra.rar # binding with a Pulsar cluster is decided by the Administrator pulsarRA.Configuration = {"brokerServiceUrl":"pulsar://localhost:6650", "webServiceUrl":"http://localhost:8080"} # configure the queue (logical JNDI name is openejb:Resource/FooQueue) FooQueue=new://Resource?type=javax.jms.Queue # binding with the Physical queue foo-queue is decided by the Administrator FooQueue.destination=foo-queue
  • 17. Live demo 17 JavaEE container: - Using Apache TomEE 8.0.6 - Deploy the Pulsar Resource Adapter (Fast JMS for Pulsar) - https://github.com/datastax/pulsar-jms/tree/master/resource-adapter - Create an Administered Object (a javax.jms.Queue) Applications: - One application with a @MessageDriver EJB that Consumes a Pulsar topic as a JMSQueue - One application with a @Singleton EJB that produces messages - Run Pulsar on local machine or on Free Astra Streaming Hosted account Live Demo https://github.com/eolivelli/pulsar-jms-examples
  • 18. Wrapping up 18 Java Messaging Service API and JavaEE: - JMS is for Messaging Systems what JDBC is for Databases - You can easily switch between from one JMS vendor to another - The ResourceAdapter allows the container to Connect to external systems - Configuration and Administration is container specific Apache Pulsar: - Pulsar is a Cloud Native Messaging System with built-in Multi-Tenancy and GeoReplication - Pulsar components are horizontally scalable, with cold data offloading - Pulsar is open source, with a vibrant community - no vendor lock-in - It very easy to switch to Pulsar if you are already using JMS Using Pulsar in a Java/JavaEE application via JMS is easy: - Use the JMS Driver and connect from your Java program - Deploy the Resource Adapter to integrate with your JavaEE® or JakartaEE® server - Fast JMS for Apache Pulsar is Open Source and ready to use out-of-the-box
  • 19. References 19 LinkedIn - linkedin.com/in/enrico-olivelli-984b7874/ Twitter: twitter.com/eolivelli Apache Pulsar Community: pulsar.apache.org/en/contact/ (Slack, ML…) References: Apache Pulsar: github.com/apache/pulsar (ASLv2) Fast JMS for Apache Pulsar - github.com/datastax/pulsar-jms (ASLv2) Jakarta JMS 2.0 speficifications - jakarta.ee/specifications/messaging/2.0/
  • 20. Thank you ! 20 We are hiring: https://www.datastax.com/company/careers

Editor's Notes

  1. June 15, 2021 Updates: Added Astra DB logo. Replaced Astra Streaming logo with updated version, while adding a horizontal lockup as a secondary option. Updated Luna Streaming logo.