SlideShare a Scribd company logo
1 of 50
Introduction to JMS and
Message-Driven POJOs
Matt Stine
Memphis JUG
March 19, 2009
Agenda
Introduction to Messaging
JMS Message Types
The JMS API
JMS Configuration
Sending and Receiving Mesages
Request/Reply Messaging
Using Spring’s JMS Support
Message-Driven POJOs with Spring
Introduction to Messaging
Why use messaging?
Why use messaging?

    Message               Message
               Message
     Sender               Receiver
               Channel
   Component             Component
Messaging Models
Messaging Models
           Point to Point

Sender




         Queue




Receiver
Messaging Models
           Point to Point

Sender             Sender            Sender




         Queue               Queue




Receiver          Receiver           Receiver
Messaging Models
           Point to Point                       Publish and Subscribe

Sender             Sender            Sender        Subscriber               Subscriber




         Queue               Queue                                      Topic




Receiver          Receiver           Receiver                   Publisher
JMS Message Structure
                    Header

     JMSDestination




                                      }
     JMSMessageID
     JMSTimestamp
     JMSCorrelationId                     Message
     JMSPriority
                                          Header
                   Properties

     App-specific Properties
     JMS-extended (JMSX) Properties
     Provider-specific Properties




                                      }
                Message Body

     Text-based Payload                   Message
     Object-based Payload
     Map-based Payload                    Payload
     Bytes-based Payload
     Stream-based Payload
JMS Message Types
TextMessage
Used for sending simple String text or XML

       Sender
       TextMessage message = session.createTextMessage();
       StringBuffer text = new StringBuffer();
       text.append("<priceRequest>");
       text.append(" <symbol>AAPL</symbol>");
       text.append("</priceRequest>");
       message.setText(messageText.toString());
       sender.send(message);



              Receiver
              TextMessage msg = (TextMessage)message;
              String xml = msg.getText();
ObjectMessage
Used for sending a serialized Java object

       Sender
       ObjectMessage message = session.createObjectMessage();
       TradeData trade = new TradeData(1, "BUY", "AAPL", 100);
       message.setObject(trade);
       sender.send(message);



               Receiver
              ObjectMessage msg = (ObjectMessage)message;
              TradeData trade = (TradeData)msg.getObject();
MapMessage
Used for sending type-safe name-value pairs

       Sender
        MapMessage message = session.createMapMessage();
        message.setString("side", "BUY");
        message.setString("symbol", "AAPL");
        message.setLong("shares", 100);
        sender.send(message);



              Receiver
             MapMessage msg = (MapMessage)message;
             String side = msg.getString("side");
             String symbol = msg.getString("symbol");
             long shares = msg.getLong("shares");
BytesMessage
Used for sending a formatted series of primitive native-format bytes

       Sender
        BytesMessage message = session.createBytesMessage();
        message.writeUTF("BUY");
        message.writeUTF("AAPL");
        message.writeInt(100);
        sender.send(message);



               Receiver
                BytesMessage msg = (BytesMessage)message;
                String side = msg.readUTF();
                String symbol = msg.readUTF();
                int shares = msg.readInt();
StreamMessage
Used for sending a formatted series of bytes as Java primitive types

       Sender
        StreamMessage message = session.createStreamMessage();
        message.writeString("BUY");
        message.writeString("AAPL");
        message.writeInt(100);
        sender.send(message);



               Receiver
                StreamMessage      msg = (StreamMessage)message;
                String side =      msg.readString();
                String symbol      = msg.readString();
                long shares =      msg.readLong();
StreamMessage
Conversion Rules
The JMS API
Generic Interfaces
                                               Message




       Connection                              Message
                        Connection   Session
        Factory                                Producer




                                               Message
       Destination
                                               Consumer




  JMS Provider (JNDI)
Queue-based Interfaces
                                              Message




        Queue
                         Queue      Queue     Queue
      Connection
                       Connection   Session   Sender
       Factory




                                               Queue
        Queue
                                              Receiver




 JMS Provider (JNDI)
Topic-based Interfaces
                                               Message




         Topic
                          Topic       Topic     Topic
       Connection
                        Connection   Session   Publisher
        Factory




                                                 Topic
         Topic
                                               Subscriber




  JMS Provider (JNDI)
JMS Configuration
Configuring a JMS Provider

Open Source Project
(http://openjms.sourceforge.net)
Comes preconfigured with Derby, but can be used
with any JDBC 2.0 compliant database
Includes an embedded JNDI Provider (Spice)
Configured using the openjms.xml configuration file
Sending and Receiving Messages
Live Coding
Sending and Receiving
Messages
Connect to the JMS provider (OpenJMS) and obtain
a connection to the message server
Send a JMS TextMessage with XML containing a
stock trade order
Create an asynchronous message listener to receive
the XML stock trade order
Request/Reply Messaging
Live Coding
Request/Reply Messaging


Modify the sender to block and wait for a return
message
Modify the asynchronous message listener to send a
confirmation number for the trade
Using Spring’s JMS Support
Spring JMS Support
Spring JMS Support

Simplifies use of JMS API
Spring JMS Support

Simplifies use of JMS API
Infrastructure in XML configuration
Spring JMS Support

Simplifies use of JMS API
Infrastructure in XML configuration
JmsTemplate in code
Spring JMS Support

Simplifies use of JMS API
Infrastructure in XML configuration
JmsTemplate in code
Message production
Spring JMS Support

Simplifies use of JMS API
Infrastructure in XML configuration
JmsTemplate in code
Message production
Synchronous nessage reception
Spring JMS Support

Simplifies use of JMS API
Infrastructure in XML configuration
JmsTemplate in code
Message production
Synchronous nessage reception

                                     Let’s Code!!!
Message-Driven POJOs with Spring
Message-Driven POJOs
with Spring
Message-Driven POJOs
with Spring
Enables asynchronous communication
Message-Driven POJOs
with Spring
Enables asynchronous communication
Little or no coupling to JMS
Message-Driven POJOs
with Spring
Enables asynchronous communication
Little or no coupling to JMS
Three options:
Message-Driven POJOs
with Spring
Enables asynchronous communication
Little or no coupling to JMS
Three options:
  Implement javax.jms.MessageListener
Message-Driven POJOs
with Spring
Enables asynchronous communication
Little or no coupling to JMS
Three options:
  Implement javax.jms.MessageListener
  Implement Spring’s SessionAwareMessageListener
Message-Driven POJOs
with Spring
Enables asynchronous communication
Little or no coupling to JMS
Three options:
  Implement javax.jms.MessageListener
  Implement Spring’s SessionAwareMessageListener
  Configure via Spring’s MessageListenerAdapter
Message-Driven POJOs
with Spring
Enables asynchronous communication
Little or no coupling to JMS
Three options:
  Implement javax.jms.MessageListener
  Implement Spring’s SessionAwareMessageListener
  Configure via Spring’s MessageListenerAdapter
Add to Spring-provided MessageListenerContainer
MDP Live Coding
MDP Live Coding
Configure
MessageListenerContainer
MDP Live Coding
Configure
MessageListenerContainer
Implement MDP that receives a
JMS message object using
default handler method
MDP Live Coding
Configure
MessageListenerContainer
Implement MDP that receives a
JMS message object using
default handler method




                                Let’s Code!!!
MDP Live Coding
Configure
MessageListenerContainer
Implement MDP that receives a
JMS message object using
default handler method
Implement MDP with automatic
message conversion


                                Let’s Code!!!
MDP Live Coding
Configure
MessageListenerContainer
Implement MDP that receives a
JMS message object using
default handler method
Implement MDP with automatic
message conversion
Implement MDP with automatic
message conversion and          Let’s Code!!!
custom handler method
Credits
 http://www.everystockphoto.com/photo.php?imageId=2743792
 http://www.everystockphoto.com/photo.php?imageId=1218094
 http://www.everystockphoto.com/photo.php?imageId=4463765
 http://www.everystockphoto.com/photo.php?imageId=2106868
 http://www.everystockphoto.com/photo.php?imageId=1310486
 http://www.everystockphoto.com/photo.php?imageId=708018
 http://www.everystockphoto.com/photo.php?imageId=3012910
 Richards, Mark. Introduction to JMS Messaging. NFJS Gateway Software Symposium 2009
 Richards, Mark. “Message Driven POJOs: Messaging Made Easy.” No Fluff Just Stuff, the
 Magazine. Jan-Mar 2009.
 http://www.allapplabs.com/interview_questions/jms_interview_questions.htm#q11

More Related Content

What's hot

Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKJosé Paumard
 
Overview - ESBs and IBM Integration Bus
Overview - ESBs and IBM Integration BusOverview - ESBs and IBM Integration Bus
Overview - ESBs and IBM Integration BusJuarez Junior
 
REST APIs and MQ
REST APIs and MQREST APIs and MQ
REST APIs and MQMatt Leming
 
Spring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesSpring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesVMware Tanzu
 
Jakarta EE: Today and Tomorrow
Jakarta EE: Today and TomorrowJakarta EE: Today and Tomorrow
Jakarta EE: Today and TomorrowDmitry Kornilov
 
Angular 8
Angular 8 Angular 8
Angular 8 Sunil OS
 
From Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfFrom Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfJosé Paumard
 
Jsf 110530152515-phpapp01
Jsf 110530152515-phpapp01Jsf 110530152515-phpapp01
Jsf 110530152515-phpapp01Eric Bourdet
 
SPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager SitesSPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager SitesGabriel Walt
 
Introduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring SecurityIntroduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring SecurityBruno Henrique Rother
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance JavaDarshit Metaliya
 
Resource Bundle
Resource BundleResource Bundle
Resource BundleSunil OS
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJSHüseyin BABAL
 
Caching In Java- Best Practises and Pitfalls
Caching In Java- Best Practises and PitfallsCaching In Java- Best Practises and Pitfalls
Caching In Java- Best Practises and PitfallsHARIHARAN ANANTHARAMAN
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkHùng Nguyễn Huy
 
Rabbit MQ introduction
Rabbit MQ introductionRabbit MQ introduction
Rabbit MQ introductionShirish Bari
 
Coroutines for Kotlin Multiplatform in Practise
Coroutines for Kotlin Multiplatform in PractiseCoroutines for Kotlin Multiplatform in Practise
Coroutines for Kotlin Multiplatform in PractiseChristian Melchior
 

What's hot (20)

Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
 
Overview - ESBs and IBM Integration Bus
Overview - ESBs and IBM Integration BusOverview - ESBs and IBM Integration Bus
Overview - ESBs and IBM Integration Bus
 
Introduction à JPA (Java Persistence API )
Introduction à JPA  (Java Persistence API )Introduction à JPA  (Java Persistence API )
Introduction à JPA (Java Persistence API )
 
REST APIs and MQ
REST APIs and MQREST APIs and MQ
REST APIs and MQ
 
Spring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesSpring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutes
 
Jakarta EE: Today and Tomorrow
Jakarta EE: Today and TomorrowJakarta EE: Today and Tomorrow
Jakarta EE: Today and Tomorrow
 
Angular 8
Angular 8 Angular 8
Angular 8
 
RabbitMQ.ppt
RabbitMQ.pptRabbitMQ.ppt
RabbitMQ.ppt
 
Java 17
Java 17Java 17
Java 17
 
From Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfFrom Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdf
 
Jsf 110530152515-phpapp01
Jsf 110530152515-phpapp01Jsf 110530152515-phpapp01
Jsf 110530152515-phpapp01
 
SPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager SitesSPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager Sites
 
Introduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring SecurityIntroduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring Security
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance Java
 
Resource Bundle
Resource BundleResource Bundle
Resource Bundle
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJS
 
Caching In Java- Best Practises and Pitfalls
Caching In Java- Best Practises and PitfallsCaching In Java- Best Practises and Pitfalls
Caching In Java- Best Practises and Pitfalls
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Rabbit MQ introduction
Rabbit MQ introductionRabbit MQ introduction
Rabbit MQ introduction
 
Coroutines for Kotlin Multiplatform in Practise
Coroutines for Kotlin Multiplatform in PractiseCoroutines for Kotlin Multiplatform in Practise
Coroutines for Kotlin Multiplatform in Practise
 

Similar to Introduction to JMS and Message-Driven POJOs

Similar to Introduction to JMS and Message-Driven POJOs (20)

Jms
JmsJms
Jms
 
Jms
JmsJms
Jms
 
Jms
JmsJms
Jms
 
Jms слайды
Jms слайдыJms слайды
Jms слайды
 
Messaging in Java
Messaging in JavaMessaging in Java
Messaging in Java
 
Jms
JmsJms
Jms
 
Java Messaging Service
Java Messaging ServiceJava Messaging Service
Java Messaging Service
 
Jms intro
Jms introJms intro
Jms intro
 
Weblogic - Introduction to configure JMS
Weblogic  - Introduction to configure JMSWeblogic  - Introduction to configure JMS
Weblogic - Introduction to configure JMS
 
Jms introduction
Jms introductionJms introduction
Jms introduction
 
Jms
JmsJms
Jms
 
Introduction tojms
Introduction tojmsIntroduction tojms
Introduction tojms
 
An Introduction to the Message Queuning Technology
An Introduction to the Message Queuning TechnologyAn Introduction to the Message Queuning Technology
An Introduction to the Message Queuning Technology
 
Java message service
Java message serviceJava message service
Java message service
 
Spring JMS
Spring JMSSpring JMS
Spring JMS
 
Test DB user
Test DB userTest DB user
Test DB user
 
test validation
test validationtest validation
test validation
 
Understanding JMS Integration Patterns
Understanding JMS Integration Patterns Understanding JMS Integration Patterns
Understanding JMS Integration Patterns
 
Jms
JmsJms
Jms
 
Jsr120 sup
Jsr120 supJsr120 sup
Jsr120 sup
 

More from Matt Stine

Architectures That Bend but Don't Break
Architectures That Bend but Don't BreakArchitectures That Bend but Don't Break
Architectures That Bend but Don't BreakMatt Stine
 
Cloud Native Architecture Patterns Tutorial
Cloud Native Architecture Patterns TutorialCloud Native Architecture Patterns Tutorial
Cloud Native Architecture Patterns TutorialMatt Stine
 
Resilient Architecture
Resilient ArchitectureResilient Architecture
Resilient ArchitectureMatt Stine
 
Cloud Foundry: The Best Place to Run Microservices
Cloud Foundry: The Best Place to Run MicroservicesCloud Foundry: The Best Place to Run Microservices
Cloud Foundry: The Best Place to Run MicroservicesMatt Stine
 
Reactive Fault Tolerant Programming with Hystrix and RxJava
Reactive Fault Tolerant Programming with Hystrix and RxJavaReactive Fault Tolerant Programming with Hystrix and RxJava
Reactive Fault Tolerant Programming with Hystrix and RxJavaMatt Stine
 
Lattice: A Cloud-Native Platform for Your Spring Applications
Lattice: A Cloud-Native Platform for Your Spring ApplicationsLattice: A Cloud-Native Platform for Your Spring Applications
Lattice: A Cloud-Native Platform for Your Spring ApplicationsMatt Stine
 
The Cloud Native Journey
The Cloud Native JourneyThe Cloud Native Journey
The Cloud Native JourneyMatt Stine
 
To Microservices and Beyond
To Microservices and BeyondTo Microservices and Beyond
To Microservices and BeyondMatt Stine
 
Deploying Microservices to Cloud Foundry
Deploying Microservices to Cloud FoundryDeploying Microservices to Cloud Foundry
Deploying Microservices to Cloud FoundryMatt Stine
 
Cloud Foundry Diego: Modular and Extensible Substructure for Microservices
Cloud Foundry Diego: Modular and Extensible Substructure for MicroservicesCloud Foundry Diego: Modular and Extensible Substructure for Microservices
Cloud Foundry Diego: Modular and Extensible Substructure for MicroservicesMatt Stine
 
Building Distributed Systems with Netflix OSS and Spring Cloud
Building Distributed Systems with Netflix OSS and Spring CloudBuilding Distributed Systems with Netflix OSS and Spring Cloud
Building Distributed Systems with Netflix OSS and Spring CloudMatt Stine
 
Pivotal Cloud Platform Roadshow: Sign Up for Pivotal Web Services
Pivotal Cloud Platform Roadshow: Sign Up for Pivotal Web ServicesPivotal Cloud Platform Roadshow: Sign Up for Pivotal Web Services
Pivotal Cloud Platform Roadshow: Sign Up for Pivotal Web ServicesMatt Stine
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoMatt Stine
 
Agile Development with OSGi
Agile Development with OSGiAgile Development with OSGi
Agile Development with OSGiMatt Stine
 
Cloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
Cloud Foundry and Microservices: A Mutualistic Symbiotic RelationshipCloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
Cloud Foundry and Microservices: A Mutualistic Symbiotic RelationshipMatt Stine
 
It's the End of the Cloud as We Know It
It's the End of the Cloud as We Know ItIt's the End of the Cloud as We Know It
It's the End of the Cloud as We Know ItMatt Stine
 
Functional solid
Functional solidFunctional solid
Functional solidMatt Stine
 
The Seven Wastes of Software Development
The Seven Wastes of Software DevelopmentThe Seven Wastes of Software Development
The Seven Wastes of Software DevelopmentMatt Stine
 
Information Sciences Solutions to Core Facility Problems at St. Jude Children...
Information Sciences Solutions to Core Facility Problems at St. Jude Children...Information Sciences Solutions to Core Facility Problems at St. Jude Children...
Information Sciences Solutions to Core Facility Problems at St. Jude Children...Matt Stine
 

More from Matt Stine (20)

Architectures That Bend but Don't Break
Architectures That Bend but Don't BreakArchitectures That Bend but Don't Break
Architectures That Bend but Don't Break
 
Cloud Native Architecture Patterns Tutorial
Cloud Native Architecture Patterns TutorialCloud Native Architecture Patterns Tutorial
Cloud Native Architecture Patterns Tutorial
 
Resilient Architecture
Resilient ArchitectureResilient Architecture
Resilient Architecture
 
Cloud Foundry: The Best Place to Run Microservices
Cloud Foundry: The Best Place to Run MicroservicesCloud Foundry: The Best Place to Run Microservices
Cloud Foundry: The Best Place to Run Microservices
 
Reactive Fault Tolerant Programming with Hystrix and RxJava
Reactive Fault Tolerant Programming with Hystrix and RxJavaReactive Fault Tolerant Programming with Hystrix and RxJava
Reactive Fault Tolerant Programming with Hystrix and RxJava
 
Lattice: A Cloud-Native Platform for Your Spring Applications
Lattice: A Cloud-Native Platform for Your Spring ApplicationsLattice: A Cloud-Native Platform for Your Spring Applications
Lattice: A Cloud-Native Platform for Your Spring Applications
 
The Cloud Native Journey
The Cloud Native JourneyThe Cloud Native Journey
The Cloud Native Journey
 
To Microservices and Beyond
To Microservices and BeyondTo Microservices and Beyond
To Microservices and Beyond
 
Deploying Microservices to Cloud Foundry
Deploying Microservices to Cloud FoundryDeploying Microservices to Cloud Foundry
Deploying Microservices to Cloud Foundry
 
Cloud Foundry Diego: Modular and Extensible Substructure for Microservices
Cloud Foundry Diego: Modular and Extensible Substructure for MicroservicesCloud Foundry Diego: Modular and Extensible Substructure for Microservices
Cloud Foundry Diego: Modular and Extensible Substructure for Microservices
 
Building Distributed Systems with Netflix OSS and Spring Cloud
Building Distributed Systems with Netflix OSS and Spring CloudBuilding Distributed Systems with Netflix OSS and Spring Cloud
Building Distributed Systems with Netflix OSS and Spring Cloud
 
Pivotal Cloud Platform Roadshow: Sign Up for Pivotal Web Services
Pivotal Cloud Platform Roadshow: Sign Up for Pivotal Web ServicesPivotal Cloud Platform Roadshow: Sign Up for Pivotal Web Services
Pivotal Cloud Platform Roadshow: Sign Up for Pivotal Web Services
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
Agile Development with OSGi
Agile Development with OSGiAgile Development with OSGi
Agile Development with OSGi
 
Cloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
Cloud Foundry and Microservices: A Mutualistic Symbiotic RelationshipCloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
Cloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
 
It's the End of the Cloud as We Know It
It's the End of the Cloud as We Know ItIt's the End of the Cloud as We Know It
It's the End of the Cloud as We Know It
 
Vert.x
Vert.xVert.x
Vert.x
 
Functional solid
Functional solidFunctional solid
Functional solid
 
The Seven Wastes of Software Development
The Seven Wastes of Software DevelopmentThe Seven Wastes of Software Development
The Seven Wastes of Software Development
 
Information Sciences Solutions to Core Facility Problems at St. Jude Children...
Information Sciences Solutions to Core Facility Problems at St. Jude Children...Information Sciences Solutions to Core Facility Problems at St. Jude Children...
Information Sciences Solutions to Core Facility Problems at St. Jude Children...
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Introduction to JMS and Message-Driven POJOs

Editor's Notes

  1. So before we get into the details of JMS, let&amp;#x2019;s take a bird&amp;#x2019;s eye view of the landscape. What is messaging all about, and why would we want to use it? Any ideas?
  2. So here&amp;#x2019;s the most basic look at a messaging architecture. You have a component that sends messages, which are sent to some type of message channel. This message channel is charged with routing the messages to other components that receive and process messages. So you have multiple components, maybe even multiple systems. They are decoupled - the sender does not know the details of the receiver, nor does the receiver know the details of the sender. What are some use cases for an architecture like this? Asynchronous processing, remoting, SOA, interoperability, integration....how about increasing user productivity? Tell the story about the guy who sends off a request and the goes to get his coffee, gets distracted, finally comes back vs. the guy who can send off a request, knows he&amp;#x2019;ll get a notification when it&amp;#x2019;s done, and continues working.
  3. So we&amp;#x2019;ll start off with point-to-point (or p2p) models. This first examples is what we&amp;#x2019;ll call Fire and Forget. You send to a queue and move on with your day. A receiver picks up the message from the queue, processes it, and moves on with its day. With p2p you have on and only one receiver per message. You may have multiple receivers load balanced, but only one component can receive each message. The second model is what we&amp;#x2019;ll call request/reply or &amp;#x201C;Pseudosynchronous.&amp;#x201D; Here the sender blocks and waits for a response from the receiver. Finally we have the publish and subscribe or pub/sub model. Here you publish or &amp;#x201C;broadcast&amp;#x201D; to not a queue, but a topic. Multiple subscribers can &amp;#x201C;listen&amp;#x201D; to this topic, and all will get a copy of each message.
  4. So we&amp;#x2019;ll start off with point-to-point (or p2p) models. This first examples is what we&amp;#x2019;ll call Fire and Forget. You send to a queue and move on with your day. A receiver picks up the message from the queue, processes it, and moves on with its day. With p2p you have on and only one receiver per message. You may have multiple receivers load balanced, but only one component can receive each message. The second model is what we&amp;#x2019;ll call request/reply or &amp;#x201C;Pseudosynchronous.&amp;#x201D; Here the sender blocks and waits for a response from the receiver. Finally we have the publish and subscribe or pub/sub model. Here you publish or &amp;#x201C;broadcast&amp;#x201D; to not a queue, but a topic. Multiple subscribers can &amp;#x201C;listen&amp;#x201D; to this topic, and all will get a copy of each message.
  5. So we&amp;#x2019;ll start off with point-to-point (or p2p) models. This first examples is what we&amp;#x2019;ll call Fire and Forget. You send to a queue and move on with your day. A receiver picks up the message from the queue, processes it, and moves on with its day. With p2p you have on and only one receiver per message. You may have multiple receivers load balanced, but only one component can receive each message. The second model is what we&amp;#x2019;ll call request/reply or &amp;#x201C;Pseudosynchronous.&amp;#x201D; Here the sender blocks and waits for a response from the receiver. Finally we have the publish and subscribe or pub/sub model. Here you publish or &amp;#x201C;broadcast&amp;#x201D; to not a queue, but a topic. Multiple subscribers can &amp;#x201C;listen&amp;#x201D; to this topic, and all will get a copy of each message.
  6. So basically you have two parts, the header and the payload. JMS distinguishes within the header between what it calls the &amp;#x201C;Header&amp;#x201D; which includes all of the standard JMS properties, and the &amp;#x201C;Properties&amp;#x201D; which includes application and/or provider-specific extension properties, as well as JMS extensions (otherwise known as JMSX properties), which may or may not be supported by all JMS providers. Finally you have the payload or &amp;#x201C;Message Body,&amp;#x201D; which distinguished what type of JMS message we&amp;#x2019;re talking about and the possible payloads it may carry.
  7. So just as we have many different colors of mailboxes here, there are many different types or &amp;#x201C;colors&amp;#x201D; of JMS messages out there.
  8. This is super cool, huh? Well, what&amp;#x2019;s wrong with this? One of the goals of messaging is decoupling of the sender and receiver. Well, in this case both Sender and Receiver must be aware of TradeData. So we end up with a tightly coupled architecture, we have versioning issues (i.e. if TradeData changes, we have to update multiple systems), and it forces heterogeneity of systems (i.e. I can&amp;#x2019;t have a non-Java consumer). UC - same machine, interservice communication.
  9. This can be useful for transfer of data between two applications in their native format which may not be compatible with other Message types. It&amp;#x2019;s also useful where JMS is used purely as a transport between two systems and the message payload is opaque to the JMS client. There is no type information encoded into the message - for example, it is possible for the sender to encode a long and the sender to read a short, resulting in semantically incorrect interpretation - it is purely up to the receiver to properly interpret the message.
  10. The alternative is the StreamMessage. This type maintains a boundary between the different data types stored, storing the data type information along with the value of the primitive. StreamMessages strictly prohibit reading incorrect types from the data stream.
  11. In fact, here are the type conversions that are supported by the StreamMessage. As you can see, just like in regular Java code, you can read to a bigger type but not to a smaller type (with the exception of String, which can be read to any of the supported types).
  12. So a couple of weekends ago I attended the NFJS symposium in St. Louis. While watching the presentations there, I gained a renewed appreciation for what properly placed images can do to enhance a talk. In fact, the use of Creative Commons licensed images came up several times. For this talk, all of the images are actually Creative Commons licensed, meaning in this case that all I have to do to use them legally is run the credits at the end of the talk. So, while searching for images for this slide, I actually entered &amp;#x201C;API&amp;#x201D; as my search criteria, thinking that nothing would come up. Imagine my surprise when I got this really cool photo of a sign. So, with that let&amp;#x2019;s examine the API...
  13. So staring with JMS 1.1, the spec consolidated the various interfaces such that all interfaces descend from common generic types, shown here.
  14. As you can see, there&amp;#x2019;s a one-to-one relationship between all of the interfaces here and the generic ones, with Message carrying over.
  15. So this is probably how many of us feel when it comes to configuration. Thankfully, configuring JMS can be relatively simple depending on your provider.
  16. For this talk we&amp;#x2019;ll be working with OpenJMS, which is great for development and testing, but is not production ready. In fact, it has been in beta for years! Go to TextMate and look at the openjms.xml file!