Using Message-Driven Beans in a Service-Oriented Architecture Dave Chappell VP & Chief Technology Evangelist, Sonic Software.

Slides:



Advertisements
Similar presentations
16 Copyright © 2005, Oracle. All rights reserved. Developing Message-Driven Beans.
Advertisements

Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
Service Oriented Architecture Terry Woods Session 50.
An architecture for webb applications, J2EE
Inside SonicMQ Progress SonicMQ  and the Java Message Standard Mitchell Horowitz Technical Product Manager, SonicMQ.
Oracle Fusion Middleware 11g Abhishek Khanolkar. What is Oracle Fusion? “Oracle Fusion Middleware is a ‘preintegrated’ portfolio of customer- proven software.
Java Messaging Services CS-328. Messaging Systems A messaging System allows and promotes the loose coupling of components –allows components to post messages.
Enterprise Applications & Java/J2EE Technologies Dr. Douglas C. Schmidt Professor of EECS.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
Java Message Service API CSE 487/587 Feb 17, 2005 References: JRun Programmer’s Guide.
JMS Java Message Service Instructor Professor: Charles Tappert By Student: Amr Fouda.
ECSE Software Engineering 1I HO 7 © HY 2012 Lecture 7 Publish/Subscribe.
CONNECT EVERYTHING. ACHIEVE ANYTHING. ™ Top Ten Enterprise Service Bus (ESB) Myths Gordon Van Huizen CTO, Sonic Software March 17, 2005.
SOA, BPM, BPEL, jBPM.
Java Messaging Services PresentationBy Anurudh Gupta.
Enterprise Java Beans CS-422. Application Servers In the late 1980s and though the mid 1990s a number of corporations (Broadvision, Netscape…) marketed.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
Java Message Service - What and Why? Bill Kelly, Silvano Maffeis SoftWired AG, Zürich
CS 493/693: Distributed Systems Programming V. “Juggy” Jagannathan CSEE, West Virginia University March 21, 2005.
Client Server Technologies Middleware Technologies Ganesh Panchanathan Alex Verstak.
95-843: Service Oriented Architecture 1 Master of Information System Management Service Oriented Architecture Lecture 10: Service Component Architecture.
Java Message Service Sangeetha Chavala. What is Messaging? Method of Communication between software components/applications peer-to-peer facility Not.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
Enterprise Java v120131Intro to JavaEE1 Java EE 5 TM Introduction.
Message Driven Beans & Web Services INFORMATICS ENGINEERING – UNIVERSITY OF BRAWIJAYA Eriq Muhammad Adams J
Web Services Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.
Asynchronous Communication Between Components Presented By: Sachin Singh.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: JMS.
Java Messaging Service. An Abstraction for using Messaging Oriented Middleware Purpose is to provide a sophisticated, yet straightforward way to exchange.
1 Java Message Service Манин П Enterprise messaging Key concept: 1. Messages are delivered asynchronously 2. Sender is not required to wait for.
A proposal for ObjectWeb ESB Antoine Mensch October 4, 2004.
Databases JDBC (Java Database Connectivity) –Thin clients – servlet,JavaServer Pages (JSP) –Thick clients – RMI to remote databases –most recommended way.
SCA Bindings Simon Holdsworth Piotr Przybylski. Agenda n SCA Bindings Overview l Bindings TC Charter n Bindings l Web Services Binding l JMS Binding l.
XML and Web Services (II/2546)
SOA-01: SOA Elucidated: Principles of Service- Oriented Architecture Ken Wilner Vice President of Technology.
JMS (Java Messaging Service)
SOA-5: Did You Get The Message? Giovanni Boschi Director, Sonic Products.
INT-9: Implementing ESB Processes with OpenEdge ® and Sonic ™ David Cleary Principal Software Engineer.
Session 7: JMS, JCA, JSF Dr. Nipat Jongsawat.
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
AMQP, Message Broker Babu Ram Dawadi. overview Why MOM architecture? Messaging broker like RabbitMQ in brief RabbitMQ AMQP – What is it ?
Java Message Service (JMS) Web Apps and Services.
SOA-05: Building an Enterprise SOA Using ESB Dave Chappell Vice President & Chief Technology Evangelist, Sonic Software.
1 Distributed System using J2EE. 2 What is J2EE?  J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Enterprise Java Beans N.V.RAJASEKHAR REDDY. Definition of EJB EJBs are the components that are the set of classes and interfaces deployed within a container.
Copyright © 2002 ProsoftTraining. All rights reserved. Enterprise JavaBeans.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
EJB Enterprise Java Beans JAVA Enterprise Edition
Java Message Service Introduction to JMS API. JMS provides a common way for Java programs to create, send, receive and read an enterprise messaging system’s.
September 28, 2010COMS W41561 COMS W4156: Advanced Software Engineering Prof. Gail Kaiser
© ScalAgent Distributed Technologies – October Objectweb ESB Initiative ObjectWeb ESB Initiative ScalAgent’s vision and proposal Roland.
Inventory of Distributed Computing Concepts and Web services
Java Messaging Service (JMS)
Java Messaging Service (JMS)
Java Messaging Service (JMS)
Harjutus 3: Aünkroonne hajussüsteemi päring
Inventory of Distributed Computing Concepts
Component-based Applications
Component Technology Bina Ramamurthy 2/25/2019 B.Ramamurthy.
Understanding and Designing with EJB
J2EE Lecture 13: JMS and WebSocket
Knowledge Byte In this section, you will learn about:
Presentation transcript:

Using Message-Driven Beans in a Service-Oriented Architecture Dave Chappell VP & Chief Technology Evangelist, Sonic Software

© 2002, Sonic Software Corporation 2

3 O’REILLY

© 2002, Sonic Software Corporation 4

5 Tell Them About the Book Raffle

© 2002, Sonic Software Corporation 6 Sonic Software n 1st J2EE 1.3 Certified MOM! n HTTP(S), XML, SOAP, WSDL, JMS, JCA n Java Message Service (JMS) n Apache Axis n Web services, JAXM, J2EE CA n XML Schema n ebXML n WS-I Driving Industry Standards

© 2002, Sonic Software Corporation 7 SonicMQ AppServer Integration n Borland Appserver n HP/Bluestone Total-e-server n BEA Weblogic –CMT,Clustering, Failover/Reconnect, Design Patterns n IBM WebSphere n Oracle Appserver n MacroMedia n JBoss (soon)

© 2002, Sonic Software Corporation 8 Sonic Software Recognized:Enterprise messaging Integration middleware Established:Over 500 of Global 2000 rely on Sonic Software StrongIndependent operating company of Progress Backing: Software Corp. (NASDAQ: PRGS) $170M cash, no debt Distribution in 65 countries, 24x7 world-wide support History:SonicMQ released 12/1999, #1 JMS product Today SonicMQ 4.0, SonicXQ 1.0 Enterprise Service Bus

© 2002, Sonic Software Corporation 9 Agenda n J2EE Message Driven Topology n JMS Overview n Using JMS With EJBs n JMS and XA Integration n J2EE Connector Architecture n Service Oriented Architectures and Web Services

© 2002, Sonic Software Corporation 10 EJB Containers J2EE Topology Web Containers JSP servlet JSP servlet EJB html gifs jpegs xml Presentation LogicBusiness Logic xml EIS Database EJB Internet

© 2002, Sonic Software Corporation 11 J2EE Topology – Message Driven Web Containers servlet JSP gifs jpegs html Presentation LogicBusiness Logic EIS Database Internet EJB Containers EJB MDB EJB Containers EJB MDB JMS

© 2002, Sonic Software Corporation 12 J2EE Topology – Message Driven Business Partner EJB Server Broker Head Office EJB Server Broker Business Partner Trading Partner Broker EJB Server Broker Regional Office

© 2002, Sonic Software Corporation 13 Agenda n J2EE Message Driven Topology n JMS Overview n Using JMS With EJBs n JMS and XA Integration n J2EE Connector Architecture n Service Oriented Architectures and Web Services

© 2002, Sonic Software Corporation 14 Java Message Service (JMS) n Sun standard n Common APIs n Loosely-coupled asynchronous processing –Senders and receivers abstractly decoupled from each other –Destinations administratively configurable at runtime n Point to Point and Pub/Sub messaging models n Supports synchronous or asynchronous communication

© 2002, Sonic Software Corporation 15 Java Message Service (JMS) n Message delivery semantics –Guaranteed Once-and-only-once –At-most-once n Deployment architecture not addressed by specification –Vendor differentiators

© 2002, Sonic Software Corporation 16 Java Message Service Business Application A JMS Messaging API JMS Messaging Client …standards based API… Messaging Components Business Application A JMS Messaging API JMS Messaging Client JMS Provider

© 2002, Sonic Software Corporation 17 Broad Range of Message Types BytesMessage Message MapMessage ObjectMessage StreamMessage TextMessage Included in JMS Specification XMLMessage Extensions in SonicMQ MultiPartMessage

© 2002, Sonic Software Corporation 18 JMS Messages Message Header Properties Body Used to identify and route the message The actual “payload” of the message (five different types, plus XML and Multipart for SonicMQ) Support application-specific values passed with the message

© 2002, Sonic Software Corporation 19 JMS Provider PublisherSubscriber PersistentStore 7. publish() method returns 2. Disconnect 2. Disconnect 5. Message retained in persistent store 1. Subscribe 6. Ack 8. Connect 10. Receive 4. Persist 3. Send 9. Retrieve Persistent messages and durable subscriptions JMS Reliability

© 2002, Sonic Software Corporation 20 JMS Reliability JMS Provider 1. Send 3. commit() 2. Send 4. Receive 6. commit() 5. ReceiveConsumerProducer Transactional Message Send and Receive

© 2002, Sonic Software Corporation 21 JMS Reliability JMS Provider 1. SendProducer XA Compliant Transaction Manager External Resource (DB/EJB) 2. Update commit() rollback()

© 2002, Sonic Software Corporation 22 Filtering with message selectors Message Server Publisher Departments.Sales Subscriber Departments.Sales Pipeline > JMSPriority = 2 Pipeline = delivered Subscriber Departments.Sales JMSPriority > 5 not delivered Subscriber Departments.Sales JMSPriority >= 2 AND Pipeline > delivered Subscriber Departments.Sales Pipeline > not delivered

© 2002, Sonic Software Corporation 23 JMS as a J2EE Resource n 2 Requirements to access a Message Provider –ConnectionFactory n Creates connection to JMS providers –Destination Object n The Specific Topic or Queue

© 2002, Sonic Software Corporation 24 Obtaining the ConnectionFactory n Resource Manager Connection Factories as Administered Objects –Specify standard mechanism for getting connections to resources outside the J2EE component –Enables the container to do pooling n JNDI is used for maximum portability QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("java:comp/env/jms/TrafficConFactory");

© 2002, Sonic Software Corporation 25 Accessing the Destination n The Specific Queue or Topic n Retrieved via JNDI –Specified in the Deployment Descriptor –Binding to a real Destination done at deploy time Topic traffic = (Topic) ctx.lookup("java:comp/env/jms/TrafficTopic");

© 2002, Sonic Software Corporation 26 What the Java/API looks like // Create a connection factory TopicConnectionFactory factory; factory = (TopicConnectionFactory)jndi.lookup("TopicConnectionF actory"); // Create a connection connect = factory.createTopicConnection (username, password); // Create a session session = connect.createTopicSession(true, Session.AUTO_ACKNOWLEDGE); // Create a topics. Topic topic = (Topic)jndi.lookup("chat");

© 2002, Sonic Software Corporation 27 What the Java/API looks like // Create Subscriber to application topics. TopicSubscriber subscriber = session.createSubscriber(topic); // Initialize the onMessage() message handler. subscriber.setMessageListener(this); // Create a publisher publsher = session.createPublisher(null); // Topic will be set for each reply // Now setup is complete, start the Connection connect.start();

© 2002, Sonic Software Corporation 28 What the Java/API looks like public void onMessage( javax.jms.Message message){ TextMessage textMessage = (TextMessage) message; System.out.println(textMessage.getText()); } -- OR –... while( true ){ textMessage = (javax.jms.TextMessage)qReceiver.receive(1000);...

© 2002, Sonic Software Corporation 29 Break

© 2002, Sonic Software Corporation 30 Do the Book Raffle

© 2002, Sonic Software Corporation 31 Agenda n J2EE Message Driven Topology n JMS Overview n Using JMS With EJBs n JMS and XA Integration n J2EE Connector Architecture n Service Oriented Architectures and Web Services

© 2002, Sonic Software Corporation 32 create lookup remove EJB Design Pattern Reminder client Remote interface stubs home object context bean Server provides resource mgmt Container methods Deployment Descriptor Automatically invokes services based on requirements defined in deployment descriptor create lookup remove methods

© 2002, Sonic Software Corporation 33 MessageDrivenBean EJB Container Publisher Bean EJB Container Subscriber Msg-driven Instance Database Durable Subscription Client App Publishes Acknowledges Delivers Stores

© 2002, Sonic Software Corporation 34 Container Msg-driven Bean Class JMS Provider MessageDrivenBean n Defined in EJB 2.x Specification n Benefits –Simple to write –Allow for asynchronous execution Destination Msg-driven Bean instances Consumer

© 2002, Sonic Software Corporation 35 MessageDrivenBean n Executes on receipt of a JMS message –javax.jms.MessageListener interface n Shares the following characteristics of stateless session bean –Is stateless and relatively short- lived –Security –Transactions –Concurrency –Management –All the other services that EJBs enjoy! –Notable difference: No home or remote interface

© 2002, Sonic Software Corporation 36 MessageDrivenBean Interface n javax.ejb.MessageDrivenBean –ejbCreate(), ejbRemove() –setMessageDrivenContext() n Just like a usual javax.jms.MessageListner –onMessage(javax.jms.Message)

© 2002, Sonic Software Corporation 37 MessageDrivenContext n get/setRollbackOnly() n getUserTransaction() –For BMT only n Others inherited from EJBContext Interface, but not allowed: –getCallerPrincipal() –isCallerInRole() –getEJBHome(), getEJBLocalHome()

© 2002, Sonic Software Corporation 38 Serialization and Concurrency n Container Must Serialize all calls to an MDB –ejbCreate(), ejbRemove(), etc –No need to be coded as re-entrant n Concurrency –Container May Launch Multiple Instances of an MDB n No guarantee of order n “Cancellation” Message May Arrive Before “Reservation” Message

© 2002, Sonic Software Corporation 39 MDB Example public class SubscriberMsgBean implements MessageDrivenBean { <… define ejbCreate(), ejbRemove() and setMessageDrivenContext( MessageDrivenContext mdc).. > MessageDrivenContext mdc = null; public void onMessage( Message inMessage) { TextMessage msg = (TextMessage) inMessage; try { } catch( Exception e) { mdc. setRollbackOnly(); }

© 2002, Sonic Software Corporation 40 MDB Example – Deployment Descriptors... SubscriberMsgBean Container NewsType='Metro/Region‘ javax.jms.Topic durable...

© 2002, Sonic Software Corporation 41 MDB Example – Deployment Descriptors QueueMessageDriven 20 1 sonicQueue com.sun.jndi.fscontext.RefFSContextFactory file://localhost/C:/temp/jndi/fileStore/ myJMSxaqcf

© 2002, Sonic Software Corporation 42 Agenda n J2EE Message Driven Topology n JMS Overview n Using JMS With EJBs n JMS and XA Integration n J2EE Connector Architecture n Service Oriented Architectures and Web Services

© 2002, Sonic Software Corporation 43 Distributed Transaction Processing (DTP) TM RM XA XA XA TMTM XA XA XA TM RM TMTM XA XA XA TM RM XA XA XA

© 2002, Sonic Software Corporation 44 A local instance of a DTP system TM RM JMS Client

© 2002, Sonic Software Corporation 45 Local DTP zoom in EJB Application Server SonicMQ Client JMS Provider JMS Provider Transaction Manager JMS Client JMS XA API XA Resource

© 2002, Sonic Software Corporation 46 XA interfaces n JMS XA SPI –XAConnectionFactory –XAConnection –XASession –XAQueueConnectionFactory –XAQueueConnection –XAQueueSession –XATopicConnectionFactory –XATopicConnection –XATopicSession

© 2002, Sonic Software Corporation 47 Agenda n J2EE Message Driven Topology n JMS Overview n Using JMS With EJBs n JMS and XA Integration n J2EE Connector Architecture n Service Oriented Architectures and Web Services

© 2002, Sonic Software Corporation 48 J2EE Directions n J2EE 1.3 –Web Applications –Asynchronous n JMS n MDB –EJB 2.0 n J2EE 1.4 –SOA Platform –Web Services n JAX-RPC n JSR-109 –J2EE Connector Architecture –EJB 2.1 n WSEI

© 2002, Sonic Software Corporation 49 J2EE Connector Architecture Overview n Defines standard for connecting J2EE to enterprise information systems (EIS) n System contracts define interface specification with EIS –Connection, Transaction, Security Enterprise Information System Resource Adapter Application Server or EAI Framework System Contract EIS Interface

© 2002, Sonic Software Corporation 50 J2EE Connector Architecture Overview n Resource adapters –Implements the EIS side of the system contracts –System-level software drivers for connecting to an EIS –Enables vendors to create standardized connectors to EIS n Common client interface –Standard API for applications to interact with heterogeneous EIS Enterprise Information System Resource Adapter Application Server or EAI Framework System Contract EIS Interface

© 2002, Sonic Software Corporation 51 Inbound Communication Model Resource Adapter JMS Destination Enterprise Java Beans JCA Container WorkManager Connection Pool Manager Transaction Manager Security Manager Work Mgmt JMS Disp EJB Disp

© 2002, Sonic Software Corporation 52 Agenda n J2EE Message Driven Topology n JMS Overview n Using JMS With EJBs n JMS and XA Integration n J2EE Connector Architecture n Service Oriented Architectures and Web Services

© 2002, Sonic Software Corporation 53 Service-Oriented Architecture Global Enterprise Internet Web Service Web Service Credit Check Web Service Credit Check Web Service Supplier Fulfill Service Supplier Fulfill Service Web Service Web Service Invoicing Service Invoicing Service Sales Service Sales Service Special Orders Order Processing Order Processing Regional Sales Regional Sales Partner App Partner App Inventory Lookup Customer App Customer App Partner App Partner App Check Inv Service Check Inv Service Order Entry Service Order Entry Service

© 2002, Sonic Software Corporation 54 Service-Oriented Architectures (SOA) n System design methodology using existing application components n Applications expose functionality through service interfaces –Loosely-coupled, asynchronous, coarse-grained n Distributed across internal networks or the Internet n Web services –Software services built on standards: SOAP, WSDL, UDDI, XML, HTTP Architecture for a Distributed World

© 2002, Sonic Software Corporation 55 Web Services Technology Stack Publication and Discovery (UDDI, ebXML Registry) Description Language (WSDL) Data Formatting (XML Dujour) Transport (HTTP, SMTP, TCP/IP) XML-RPC (SOAP-RPC, JAX-RPC) XML Messaging (SOAP, ebXML,JAXM)

© 2002, Sonic Software Corporation 56 Web Services Technology Stack XML-RPC (SOAP-RPC, JAX-RPC) Publication and Discovery (UDDI, ebXML Registry) Description Language (WSDL) Data Formatting (XML Dujour) Transport (HTTP, SMTP, TCP/IP) XML Messaging (SOAP, ebXML,JAXM) Quality of Service JMS, ebXML-MS, HTTPR

© 2002, Sonic Software Corporation 57 Connecting (Web) Services Together n (Web) Services aren’t Islands of Themselves n Network of Cooperative Services n Interfaces, Discovery, and Data Formats are only part of the big picture –Data transformation –Intelligent Routing based on content –End-to-end guaranteed delivery –Management, configuration, and auditing –Performance and scalability –Asynchronous and synchronous messaging –Security –Deployment tools What Else Do You Need?

© 2002, Sonic Software Corporation 58 Standards Working Together... JAXM/RPC Client Apache Client Servlet Container.NET SOAP Client JMS message SOAP/HTTP Web Client SOAP/HTTP Internet JMS Messaging Backbone SOAP/HTTP SOAP/JMS SOAP/HTTP SOAP/JMS SOAP/HTTP SOAP/JMS JMS message JCA/EIS EJB Container JMS ClientC++ Client JCA/EIS

© 2002, Sonic Software Corporation 59 Contact Information n m m n om Integrate with Ease. Extend at Will TM.