SlideShare ist ein Scribd-Unternehmen logo
1 von 20
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

Weitere ähnliche Inhalte

Was ist angesagt?

모바일 게임 보안
모바일 게임 보안모바일 게임 보안
모바일 게임 보안TOAST_NHNent
 
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective IndexingMongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective IndexingMongoDB
 
Federated Engine 실무적용사례
Federated Engine 실무적용사례Federated Engine 실무적용사례
Federated Engine 실무적용사례I Goo Lee
 
Angular and The Case for RxJS
Angular and The Case for RxJSAngular and The Case for RxJS
Angular and The Case for RxJSSandi Barr
 
Hive Anatomy
Hive AnatomyHive Anatomy
Hive Anatomynzhang
 
Jdbc in servlets
Jdbc in servletsJdbc in servlets
Jdbc in servletsNuha Noor
 
Json in Postgres - the Roadmap
 Json in Postgres - the Roadmap Json in Postgres - the Roadmap
Json in Postgres - the RoadmapEDB
 
OWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesOWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesChristopher Frohoff
 
Super scaling singleton inserts
Super scaling singleton insertsSuper scaling singleton inserts
Super scaling singleton insertsChris Adkin
 
ElasticSearch : Architecture et Développement
ElasticSearch : Architecture et DéveloppementElasticSearch : Architecture et Développement
ElasticSearch : Architecture et DéveloppementMohamed hedi Abidi
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Svetlin Nakov
 
Advanced task management with Celery
Advanced task management with CeleryAdvanced task management with Celery
Advanced task management with CeleryMahendra M
 
Data processing with celery and rabbit mq
Data processing with celery and rabbit mqData processing with celery and rabbit mq
Data processing with celery and rabbit mqJeff Peck
 
Deep Dive Into Kafka Tiered Storage With Satish Duggana | Current 2022
Deep Dive Into Kafka Tiered Storage With Satish Duggana | Current 2022Deep Dive Into Kafka Tiered Storage With Satish Duggana | Current 2022
Deep Dive Into Kafka Tiered Storage With Satish Duggana | Current 2022HostedbyConfluent
 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesJonathan Katz
 

Was ist angesagt? (20)

모바일 게임 보안
모바일 게임 보안모바일 게임 보안
모바일 게임 보안
 
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective IndexingMongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
 
Sequelize
SequelizeSequelize
Sequelize
 
Celery
CeleryCelery
Celery
 
Federated Engine 실무적용사례
Federated Engine 실무적용사례Federated Engine 실무적용사례
Federated Engine 실무적용사례
 
Angular and The Case for RxJS
Angular and The Case for RxJSAngular and The Case for RxJS
Angular and The Case for RxJS
 
Hive Anatomy
Hive AnatomyHive Anatomy
Hive Anatomy
 
Jdbc in servlets
Jdbc in servletsJdbc in servlets
Jdbc in servlets
 
Json in Postgres - the Roadmap
 Json in Postgres - the Roadmap Json in Postgres - the Roadmap
Json in Postgres - the Roadmap
 
OWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesOWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling Pickles
 
Spring Data JPA
Spring Data JPASpring Data JPA
Spring Data JPA
 
Super scaling singleton inserts
Super scaling singleton insertsSuper scaling singleton inserts
Super scaling singleton inserts
 
How to Use JSON in MySQL Wrong
How to Use JSON in MySQL WrongHow to Use JSON in MySQL Wrong
How to Use JSON in MySQL Wrong
 
ElasticSearch : Architecture et Développement
ElasticSearch : Architecture et DéveloppementElasticSearch : Architecture et Développement
ElasticSearch : Architecture et Développement
 
Log4 J
Log4 JLog4 J
Log4 J
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
 
Advanced task management with Celery
Advanced task management with CeleryAdvanced task management with Celery
Advanced task management with Celery
 
Data processing with celery and rabbit mq
Data processing with celery and rabbit mqData processing with celery and rabbit mq
Data processing with celery and rabbit mq
 
Deep Dive Into Kafka Tiered Storage With Satish Duggana | Current 2022
Deep Dive Into Kafka Tiered Storage With Satish Duggana | Current 2022Deep Dive Into Kafka Tiered Storage With Satish Duggana | Current 2022
Deep Dive Into Kafka Tiered Storage With Satish Duggana | Current 2022
 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with Kubernetes
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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...
 

Kürzlich hochgeladen

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Kürzlich hochgeladen (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

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

Hinweis der Redaktion

  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.