SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaJeff Holoman
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message BrokerMartin Toshev
 
IBM MQ High Availability 2019
IBM MQ High Availability 2019IBM MQ High Availability 2019
IBM MQ High Availability 2019David Ware
 
Standardizing the Data Distribution Service (DDS) API for Modern C++
Standardizing the Data Distribution Service (DDS) API for Modern C++Standardizing the Data Distribution Service (DDS) API for Modern C++
Standardizing the Data Distribution Service (DDS) API for Modern C++Sumant Tambe
 
Programmation réactive avec Spring 5 et Reactor
Programmation réactive avec Spring 5 et ReactorProgrammation réactive avec Spring 5 et Reactor
Programmation réactive avec Spring 5 et ReactorFlorian Beaufumé
 
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia GuptaIntro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia GuptaInfluxData
 
IBM MQ - What's new in 9.2
IBM MQ - What's new in 9.2IBM MQ - What's new in 9.2
IBM MQ - What's new in 9.2David Ware
 
Cours 4 intergiciels orientes messages jms
Cours 4 intergiciels orientes messages  jmsCours 4 intergiciels orientes messages  jms
Cours 4 intergiciels orientes messages jmsMariem ZAOUALI
 
Introduction to Message-Oriented Middleware
Introduction to Message-Oriented MiddlewareIntroduction to Message-Oriented Middleware
Introduction to Message-Oriented MiddlewareEdward Curry
 
Easy enterprise application integration with RabbitMQ and AMQP
Easy enterprise application integration with RabbitMQ and AMQPEasy enterprise application integration with RabbitMQ and AMQP
Easy enterprise application integration with RabbitMQ and AMQPRabbit MQ
 
Introduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQIntroduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQDmitriy Samovskiy
 
Websphere MQ (MQSeries) fundamentals
Websphere MQ (MQSeries) fundamentalsWebsphere MQ (MQSeries) fundamentals
Websphere MQ (MQSeries) fundamentalsBiju Nair
 
Apache ActiveMQ and Apache Camel
Apache ActiveMQ and Apache CamelApache ActiveMQ and Apache Camel
Apache ActiveMQ and Apache CamelOmi Om
 
Rabbit MQ introduction
Rabbit MQ introductionRabbit MQ introduction
Rabbit MQ introductionShirish Bari
 
Kafka: Uma introdução para Desenvolvedores e Arquitetos
 Kafka: Uma introdução para Desenvolvedores e Arquitetos Kafka: Uma introdução para Desenvolvedores e Arquitetos
Kafka: Uma introdução para Desenvolvedores e ArquitetosVictor Osorio
 
End-to-end Streaming Between gRPC Services Via Kafka with John Fallows
End-to-end Streaming Between gRPC Services Via Kafka with John FallowsEnd-to-end Streaming Between gRPC Services Via Kafka with John Fallows
End-to-end Streaming Between gRPC Services Via Kafka with John FallowsHostedbyConfluent
 

Tendances (20)

AMQP
AMQPAMQP
AMQP
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message Broker
 
IBM MQ High Availability 2019
IBM MQ High Availability 2019IBM MQ High Availability 2019
IBM MQ High Availability 2019
 
Standardizing the Data Distribution Service (DDS) API for Modern C++
Standardizing the Data Distribution Service (DDS) API for Modern C++Standardizing the Data Distribution Service (DDS) API for Modern C++
Standardizing the Data Distribution Service (DDS) API for Modern C++
 
Programmation réactive avec Spring 5 et Reactor
Programmation réactive avec Spring 5 et ReactorProgrammation réactive avec Spring 5 et Reactor
Programmation réactive avec Spring 5 et Reactor
 
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia GuptaIntro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
 
IBM MQ - What's new in 9.2
IBM MQ - What's new in 9.2IBM MQ - What's new in 9.2
IBM MQ - What's new in 9.2
 
Cours 4 intergiciels orientes messages jms
Cours 4 intergiciels orientes messages  jmsCours 4 intergiciels orientes messages  jms
Cours 4 intergiciels orientes messages jms
 
IBM MQ Series For ZOS
IBM MQ Series For ZOSIBM MQ Series For ZOS
IBM MQ Series For ZOS
 
Introduction to Message-Oriented Middleware
Introduction to Message-Oriented MiddlewareIntroduction to Message-Oriented Middleware
Introduction to Message-Oriented Middleware
 
Easy enterprise application integration with RabbitMQ and AMQP
Easy enterprise application integration with RabbitMQ and AMQPEasy enterprise application integration with RabbitMQ and AMQP
Easy enterprise application integration with RabbitMQ and AMQP
 
Introduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQIntroduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQ
 
Websphere MQ (MQSeries) fundamentals
Websphere MQ (MQSeries) fundamentalsWebsphere MQ (MQSeries) fundamentals
Websphere MQ (MQSeries) fundamentals
 
Apache ActiveMQ and Apache Camel
Apache ActiveMQ and Apache CamelApache ActiveMQ and Apache Camel
Apache ActiveMQ and Apache Camel
 
Spring Security 5
Spring Security 5Spring Security 5
Spring Security 5
 
RabbitMQ.pptx
RabbitMQ.pptxRabbitMQ.pptx
RabbitMQ.pptx
 
Rabbit MQ introduction
Rabbit MQ introductionRabbit MQ introduction
Rabbit MQ introduction
 
Kafka: Uma introdução para Desenvolvedores e Arquitetos
 Kafka: Uma introdução para Desenvolvedores e Arquitetos Kafka: Uma introdução para Desenvolvedores e Arquitetos
Kafka: Uma introdução para Desenvolvedores e Arquitetos
 
End-to-end Streaming Between gRPC Services Via Kafka with John Fallows
End-to-end Streaming Between gRPC Services Via Kafka with John FallowsEnd-to-end Streaming Between gRPC Services Via Kafka with John Fallows
End-to-end Streaming Between gRPC Services Via Kafka with John Fallows
 

Similaire à Introduction to JMS and Message-Driven POJOs

Similaire à 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 validation
test validationtest validation
test validation
 
Test DB user
Test DB userTest DB user
Test DB user
 
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
 

Plus de 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
 

Plus de 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...
 

Dernier

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 

Dernier (20)

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 

Introduction to JMS and Message-Driven POJOs

Notes de l'éditeur

  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!