Your SlideShare is downloading. ×
0
Using Message-Driven Beans in a Service-Oriented Architecture <ul><li>Dave Chappell   </li></ul><ul><ul><li>VP & Chief Tec...
 
O’REILLY
 
Tell Them About  the  Book Raffle
Sonic Software <ul><li>1st J2EE 1.3 Certified MOM! </li></ul><ul><li>HTTP(S), XML, SOAP, WSDL, JMS, JCA  </li></ul><ul><li...
SonicMQ AppServer Integration <ul><li>Borland Appserver </li></ul><ul><li>HP/Bluestone Total-e-server </li></ul><ul><li>BE...
Sonic Software <ul><li>Recognized: Enterprise messaging Integration middleware </li></ul><ul><li>Established: Over 500 of ...
Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul...
J2EE Topology EJB Containers Web Containers JSP servlet servlet JSP servlet EJB html gifs jpegs xml Presentation Logic Bus...
J2EE Topology – Message Driven Web  Containers servlet servlet JSP gifs jpegs html Presentation Logic Business Logic EIS D...
J2EE Topology – Message Driven EJB Server EJB Server EJB Server Broker EJB Server EJB Server EJB Server Broker Business Pa...
Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul...
Java Message Service (JMS) <ul><li>Sun standard </li></ul><ul><li>Common APIs </li></ul><ul><li>Loosely-coupled asynchrono...
Java Message Service (JMS) <ul><li>Message delivery semantics </li></ul><ul><ul><li>Guaranteed Once-and-only-once </li></u...
Java Message Service Business Application A JMS Messaging API JMS Messaging Client … standards based API… Messaging  Compo...
Broad Range of Message Types BytesMessage Message MapMessage ObjectMessage StreamMessage TextMessage Included in JMS Speci...
JMS Messages Message Header Properties Body Used to identify and route the message The actual “payload” of the message (fi...
JMS Reliability JMS Provider Publisher Subscriber Persistent Store 7.  publish() method returns 2.  Disconnect 5.  Message...
JMS Reliability JMS Provider Consumer Producer Transactional Message Send and Receive 1.  Send 3.  commit() 2.  Send 4.  R...
JMS Reliability JMS Provider Producer XA Compliant Transaction Manager External Resource (DB/EJB) commit() rollback() 1.  ...
Filtering with message selectors Message Server Publisher Departments.Sales Subscriber Departments.Sales Pipeline > 15000 ...
JMS as a J2EE Resource <ul><li>2 Requirements to access a Message Provider </li></ul><ul><ul><li>ConnectionFactory </li></...
Obtaining the ConnectionFactory <ul><li>Resource Manager Connection Factories as Administered Objects </li></ul><ul><ul><l...
Accessing the Destination <ul><li>The Specific Queue or Topic </li></ul><ul><li>Retrieved via JNDI </li></ul><ul><ul><li>S...
What the Java/API looks like // Create a connection factory TopicConnectionFactory factory; factory = (TopicConnectionFact...
What the Java/API looks like // Create Subscriber to application topics. TopicSubscriber subscriber = session.createSubscr...
What the Java/API looks like public void onMessage( javax.jms.Message message){ TextMessage textMessage = (TextMessage) me...
Break
Do the  Book Raffle
Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul...
EJB Design Pattern Reminder create lookup remove client Remote interface stubs home object context bean Server  provides r...
MessageDrivenBean EJB Container Publisher Bean EJB Container Subscriber Msg-driven Instance Database Durable Subscription ...
MessageDrivenBean <ul><li>Defined in EJB 2.x Specification  </li></ul><ul><li>Benefits  </li></ul><ul><ul><li>Simple to wr...
MessageDrivenBean <ul><li>Executes on receipt of a JMS message </li></ul><ul><ul><li>javax.jms.MessageListener interface <...
MessageDrivenBean Interface <ul><li>javax.ejb.MessageDrivenBean </li></ul><ul><ul><li>ejbCreate(), ejbRemove() </li></ul><...
MessageDrivenContext <ul><li>get/setRollbackOnly() </li></ul><ul><li>getUserTransaction() </li></ul><ul><ul><li>For BMT on...
Serialization and Concurrency <ul><li>Container Must Serialize all calls to an MDB </li></ul><ul><ul><li>ejbCreate(), ejbR...
MDB Example <ul><li>public class SubscriberMsgBean implements MessageDrivenBean { </li></ul><ul><li><… define ejbCreate(),...
MDB Example –  Deployment Descriptors <ul><li><message-driven> </li></ul><ul><li>... </li></ul><ul><li><ejb-class>Subscrib...
MDB Example –  Deployment Descriptors <ul><li><weblogic-enterprise-bean> </li></ul><ul><li><ejb-name>QueueMessageDriven</e...
Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul...
Distributed Transaction Processing (DTP) <ul><li>TM </li></ul>RM RM RM XA XA XA <ul><li>TM </li></ul>RM RM RM RM XA XA XA ...
A local instance of a DTP system <ul><li>TM </li></ul><ul><li>JMS Client </li></ul>RM RM
Local DTP zoom in EJB Application Server SonicMQ Client JMS Provider Transaction Manager JMS Client JMS XA API XA Resource
XA interfaces <ul><li>JMS XA SPI </li></ul><ul><ul><li>XAConnectionFactory </li></ul></ul><ul><ul><li>XAConnection </li></...
Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul...
J2EE Directions <ul><li>J2EE 1.3 </li></ul><ul><ul><li>Web Applications </li></ul></ul><ul><ul><li>Asynchronous </li></ul>...
J2EE Connector Architecture Overview <ul><li>Defines standard for connecting J2EE to enterprise information systems (EIS) ...
J2EE Connector Architecture Overview <ul><li>Resource adapters </li></ul><ul><ul><li>Implements the EIS side of the system...
Inbound Communication Model Resource Adapter JMS Destination Enterprise Java Beans Work Mgmt JMS Disp EJB Disp JCA Contain...
Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul...
Service-Oriented Architecture Global Enterprise Internet Web Service Credit Check Web Service Supplier Fulfill Service Web...
Service-Oriented Architectures (SOA) <ul><li>System design methodology using existing application components </li></ul><ul...
Web Services Technology Stack Publication and Discovery (UDDI, ebXML Registry) Description Language (WSDL) Data Formatting...
Web Services Technology Stack XML-RPC (SOAP-RPC, JAX-RPC) XML Messaging (SOAP, ebXML,JAXM) Publication and Discovery (UDDI...
Connecting (Web) Services Together <ul><li>(Web) Services aren’t Islands of Themselves </li></ul><ul><li>Network of Cooper...
Standards Working Together... JAXM/RPC Client Apache Client Servlet  Container .NET SOAP Client SOAP/HTTP Web Client SOAP/...
Contact Information <ul><li>[email_address] </li></ul><ul><li>http://www.sonicsoftware.com </li></ul>Integrate with Ease. ...
Upcoming SlideShare
Loading in...5
×

Top 6 goals - Evangelism

529

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
529
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Slide Purpose: Introduction Slide Main message(s): Introductions This presentation is a overview of the challenges faced by organizations today, and how Service-Oriented Architectures and the Enterprise Service Bus address these challenges.
  • O’Reilly has published a book by Richard Monson-Haefel and SonicMQ’s Dave Chappell entitled “Java Message Service”. Aside from the JMS specification, it is the most comprehensive document on the market that covers all the intricacies of JMS.
  • For more information about how SOAP, JAXM, ebXML, and JMS complement each other, please refer to chapter 7 of this book – due out end of November 2001.
  • Slide Purpose: Introduce Sonic as a standards leader. Main message(s): Standards support is critical for your business. Sonic is driving and supporting industry standards. Factoid: Sonic Software is 1 of 36 Authorized J2EE Licensed companies( Feb 2002) Factoid: SonicMQ is the first message oriented middleware to pass J2EE 1.3 certification- which is over 14,000 individual tests! Today, it is imperative that applications be built using standards, so you can maximize your IT investment. Our products have an open and flexible architecture using industry standards. Why is standards support important? This means that you are not locked into a single vendor – you can pick best-of-breed solutions, e.g. the best J2EE AppServer and the best JMS Messaging Solution. You do not need to subscribe to a “one-size-fits-all” approach, which may be both expensive and not completely meet your needs. Standards support enables seamless interoperability between applications, minimizes coding efforts and improves quality. Sonic Software drives several standards, e.g. JMS, Web services, JAXM, JCA– we are an Expert Group Member on several of the Java Specification Request (JSR) efforts within the Java Community Process. Sonic Software (through their parent Progress Software) is a member of the W3C – XML Schema committee. Sonic participates in the OASIS ebXML Messaging Technical Committee and the Joint Committee. Overall, Sonic Software’s role in defining standards translates into your applications being more “plug-and-play”.
  • Slide Purpose: High level overview of Sonic Software Main message(s): Sonic is entrepreneurial and has strong financial backing. (not an unstable Dot Com startup) Sonic Software was established in 1998 with funding and resources from parent company, Progress Software. Progress Software is a recognized 20 year veteran and leader in the development tools, middleware and database markets. This environment offers Sonic Software the best of both worlds – Sonic Software is a focused, energetic, entrepreneurial company and has long term financial stability from PSC With this focus, Sonic Software has become the # 1 JMS and #1 OEM embedded Message Oriented Middleware. As enterprise customers require enterprise support, Sonic Software provides 24x7 worldwide support with offices in USA (Bedford, MA HQ), EMEA (Netherlands), and Asia Pacific (Australia).
  • Slide Purpose: High level example of Messaging Main message(s): Here we apply the JMS concepts that we have just discussed an applied them to a distributed application infrastructure which LINKS: HEAD OFFICE Regional Office Trading Partner Marketplace (which has a trading partner) &lt;click&gt; Here we see how these entities can be linked using a JMS which provides: Ability to do synchronous or asynchronous communication Use point-to-point or pub sub model Brokers allows easy and flexible integration Reliability Fault-tolerance
  • JMS is simply an API and a set of semantics that define how JMS-based clients access the facilities of an enterprise messaging product. It was introduced by Javasoft in 1998 as part of an industry effort to standardize messaging requirements. The JMS specification was an industry effort based on the messaging vendors that were around at the time. The intent was to create a standard set of APIs and message delivery semantics. However, the intent changed over the course of the work to create a specification for a first class middleware in its own right, on equal footing with RPC-like technologies such as CORBA and RMI. The net result is not a least-common-denominator approach, but a rich set of APIs and semantics that cover a “best-of” conglomeration of all the messaging products that have existed over the past decade. “ Message Delivery Semantics” include definitions for: guaranteed delivery of messages through asynchronous store and forward mechanisms. A range of delivery modes Once-and-only-once delivery, which means that regardless of the deployment topology, or vendor specific architecture, that Purchase Order is guaranteed to get there once, and only once. The other range of the spectrum is at-most-once. The example most often used is that of a stock ticker broadcast What the specification does not address is: Load balancing/fault tolerance Error/Advisory notification Administration Security
  • JMS is simply an API and a set of semantics that define how JMS-based clients access the facilities of an enterprise messaging product. It was introduced by Javasoft in 1998 as part of an industry effort to standardize messaging requirements. The JMS specification was an industry effort based on the messaging vendors that were around at the time. The intent was to create a standard set of APIs and message delivery semantics. However, the intent changed over the course of the work to create a specification for a first class middleware in its own right, on equal footing with RPC-like technologies such as CORBA and RMI. The net result is not a least-common-denominator approach, but a rich set of APIs and semantics that cover a “best-of” conglomeration of all the messaging products that have existed over the past decade. “ Message Delivery Semantics” include definitions for: guaranteed delivery of messages through asynchronous store and forward mechanisms. A range of delivery modes Once-and-only-once delivery, which means that regardless of the deployment topology, or vendor specific architecture, that Purchase Order is guaranteed to get there once, and only once. The other range of the spectrum is at-most-once. The example most often used is that of a stock ticker broadcast What the specification does not address is: Load balancing/fault tolerance Error/Advisory notification Administration Security
  • Slide Purpose: Relate to previous MOM slide on how JMS fits in Main message(s): JMS is conceptually just like MOM Here, we take the messaging middleware components we talked about earlier and relate them to the terms used to describe each as defined in the JMS specification. 3 PARTS: API: There is a standardized API that you call from your Java-based application, which in turn calls …. CLIENT: JMS client , which contains messaging logic, recovery, and security mechanisms. BROKER: The JMS Broker , is responsible for: - gathering requests - queuing the requests - ensuring they arrive.
  • NOTE: This is a build slide. The JMS specification identifies 5 basic message types that address the majority of the requirements of applications today. These message types are: Bytes message – a message that contains a stream of uninterrupted bytes. Map message – a message whose body contains a set of name-value pairs where names are Strings and values are Java primitive types Object message – a message that contains a Serializable object Stream message – a message whose body contains a stream of Java primitive values Text message – a message whose body contains a java.lang.String &lt;next build&gt; SonicMQ extends the JMS Text Message object to create an XML Message type. This message type simplifies the processing of an XML-formatted message by allowing it to be represented as a DOM (document object model). Sun is considering revising the JMS specification to include XML as a separate message type.
  • SonicMQ provides different Quality of Service (QoS) support depending on the needs of the application. In the case of where you want to protect the messaging environment from the event of hardware failure, it is advised to use persistent messaging. This diagram shows the steps taken in the publishing of a message in a persistent manner. The JMS client (producer) uses the publish method to publish a message on a topic of interest. It’s the client that specifies whether the message is sent to a topic or queue persistently as part of the JMS properties in the message header (JMSDeliveryMode). In this case, the message is written to the persistent store before acknowledgement is sent back to the client indicating that the message was successfully received. If in the event that the server should go down during the process of receiving and storing the message, the message is considered undelivered by the client. This is especially powerful when you use clustered servers. If a client did not receive acknowledgement of receipt of the message, it will attempt redelivery to that server or another server in its static routing table. Acknowledgement doesn’t necessarily mean that the message was delivered to its final destination. Once the server acknowledges receipt of the message, the client is alleviated of any further responsibility. It is then up to the SonicMQ server and it’s facilities to ensure reliable guaranteed delivery from that point forward. When the server recovers from a failure, any persistent undelivered messages will then be delivered to their intended recipients.
  • This diagram shows 2 transacted messages; one on the producers side and one on the consumer’s side. From the producers side, transacted messages sent to the server must be followed by a commit() method call from the client. It’s only at that point that the server will acknowledge and process the messages. The client can also chose to rollback() the message at any point. The server will not process anything sent within the bounds of the transaction. The same is true for the receipt of message on the consumer’s side. Transaction scope are not limited to just to sending or receiving messages individually. A transacted messages can include many send and many receipts of messages as a single unit of work. As these are not considered “database” transactions, there is no requirement for a transaction monitor to be used.
  • The vendors could be the EIS vendors themselves
  • Slide Purpose: Show example of service-centric view Main message(s): &lt;This is meant as a quick supporting graphic – not a detailed discussion&gt; With a service centric view – services are talking to applications and other services.
  • Slide Purpose: Introduce concept of Service-oriented Architecture Main message(s): Business systems today, however, are being constructed by tying together reusable logic components. Thus, instead of duplicating code, existing systems are being exposed as services for other systems to consume and new processes are being created that cross multiple applications. They are: loosely-coupled -meaning that services can operate on their own as well as with each other when they need to; can communicate asynchronously, so senders and receivers are not dependent on the availability of each other; and are coarse-grained-meaning that they are a collection of higher level processes. A service-oriented architecture is a design to reuse components in this manner and can be distributed across an internal network or the Internet. Web services, simply put, are software as a service over a network. You are probably very familiar with some basic “services over the web” such as a Stock Quote (I.e. send a Ticker Symbol to a system, and get the current price), or using the UPS online tracking system -it will send to you the status of your package. Web services are considered an implementation of a Service-Oriented Architecture. The primary concept here is investment protection in your current technology. Even without Web services, all companies should be architecting building SOA today.
  • Clients use JAXM, JAX-RPC, ApacheSoap, Axis, or .NET Send SOAP messages through the internet over HTTP Map SOAP messages to the JMS enterprise message bus Use J2EE CA to Connect to EIS/legacy apps Use MDB to call into EJB server when necessary
  • Transcript of "Top 6 goals - Evangelism"

    1. 1. Using Message-Driven Beans in a Service-Oriented Architecture <ul><li>Dave Chappell </li></ul><ul><ul><li>VP & Chief Technology Evangelist, Sonic Software </li></ul></ul>
    2. 3. O’REILLY
    3. 5. Tell Them About the Book Raffle
    4. 6. Sonic Software <ul><li>1st J2EE 1.3 Certified MOM! </li></ul><ul><li>HTTP(S), XML, SOAP, WSDL, JMS, JCA </li></ul><ul><li>Java Message Service (JMS) </li></ul><ul><li>Apache Axis </li></ul><ul><li>Web services, JAXM, J2EE CA </li></ul><ul><li>XML Schema </li></ul><ul><li>ebXML </li></ul><ul><li>WS-I </li></ul>Driving Industry Standards
    5. 7. SonicMQ AppServer Integration <ul><li>Borland Appserver </li></ul><ul><li>HP/Bluestone Total-e-server </li></ul><ul><li>BEA Weblogic </li></ul><ul><ul><li>CMT,Clustering, Failover/Reconnect, Design Patterns </li></ul></ul><ul><li>IBM WebSphere </li></ul><ul><li>Oracle Appserver </li></ul><ul><li>MacroMedia </li></ul><ul><li>JBoss (soon) </li></ul>
    6. 8. Sonic Software <ul><li>Recognized: Enterprise messaging Integration middleware </li></ul><ul><li>Established: Over 500 of Global 2000 rely on Sonic Software </li></ul><ul><li>Strong Independent operating company of Progress Backing: Software Corp. (NASDAQ: PRGS) $170M cash, no debt Distribution in 65 countries, 24x7 world-wide support </li></ul><ul><li>History: SonicMQ released 12/1999, #1 JMS product Today SonicMQ 4.0, SonicXQ 1.0 Enterprise Service Bus </li></ul>
    7. 9. Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul><ul><li>JMS and XA Integration </li></ul><ul><li>J2EE Connector Architecture </li></ul><ul><li>Service Oriented Architectures and Web Services </li></ul>
    8. 10. J2EE Topology EJB Containers Web Containers JSP servlet servlet JSP servlet EJB html gifs jpegs xml Presentation Logic Business Logic xml EIS Database EJB EJB EJB EJB EJB EJB EJB EJB Internet
    9. 11. J2EE Topology – Message Driven Web Containers servlet servlet JSP gifs jpegs html Presentation Logic Business Logic EIS Database JMS Internet EJB Containers EJB EJB EJB MDB MDB MDB EJB Containers EJB EJB EJB MDB MDB MDB
    10. 12. J2EE Topology – Message Driven EJB Server EJB Server EJB Server Broker EJB Server EJB Server EJB Server Broker Business Partner Trading Partner Broker EJB Server EJB Server Broker Regional Office Business Partner Head Office
    11. 13. Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul><ul><li>JMS and XA Integration </li></ul><ul><li>J2EE Connector Architecture </li></ul><ul><li>Service Oriented Architectures and Web Services </li></ul>
    12. 14. Java Message Service (JMS) <ul><li>Sun standard </li></ul><ul><li>Common APIs </li></ul><ul><li>Loosely-coupled asynchronous processing </li></ul><ul><ul><li>Senders and receivers abstractly decoupled from each other </li></ul></ul><ul><ul><li>Destinations administratively configurable at runtime </li></ul></ul><ul><li>Point to Point and Pub/Sub messaging models </li></ul><ul><li>Supports synchronous or asynchronous communication </li></ul>
    13. 15. Java Message Service (JMS) <ul><li>Message delivery semantics </li></ul><ul><ul><li>Guaranteed Once-and-only-once </li></ul></ul><ul><ul><li>At-most-once </li></ul></ul><ul><li>Deployment architecture not addressed by specification </li></ul><ul><ul><li>Vendor differentiators </li></ul></ul>
    14. 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
    15. 17. Broad Range of Message Types BytesMessage Message MapMessage ObjectMessage StreamMessage TextMessage Included in JMS Specification XMLMessage Extensions in SonicMQ MultiPartMessage
    16. 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
    17. 19. JMS Reliability JMS Provider Publisher Subscriber Persistent Store 7. publish() method returns 2. Disconnect 5. Message retained in persistent store Persistent messages and durable subscriptions 1. Subscribe 6. Ack 8. Connect 10. Receive 4. Persist 3. Send 9. Retrieve
    18. 20. JMS Reliability JMS Provider Consumer Producer Transactional Message Send and Receive 1. Send 3. commit() 2. Send 4. Receive 6. commit() 5. Receive
    19. 21. JMS Reliability JMS Provider Producer XA Compliant Transaction Manager External Resource (DB/EJB) commit() rollback() 1. Send 2. Update
    20. 22. Filtering with message selectors Message Server Publisher Departments.Sales Subscriber Departments.Sales Pipeline > 15000 JMSPriority = 2 Pipeline = 20000 delivered Subscriber Departments.Sales JMSPriority > 5 not delivered Subscriber Departments.Sales JMSPriority >= 2 AND Pipeline > 10000 delivered Subscriber Departments.Sales Pipeline > 20000 not delivered
    21. 23. JMS as a J2EE Resource <ul><li>2 Requirements to access a Message Provider </li></ul><ul><ul><li>ConnectionFactory </li></ul></ul><ul><ul><ul><li>Creates connection to JMS providers </li></ul></ul></ul><ul><ul><li>Destination Object </li></ul></ul><ul><ul><ul><li>The Specific Topic or Queue </li></ul></ul></ul>
    22. 24. Obtaining the ConnectionFactory <ul><li>Resource Manager Connection Factories as Administered Objects </li></ul><ul><ul><li>Specify standard mechanism for getting connections to resources outside the J2EE component </li></ul></ul><ul><ul><li>Enables the container to do pooling </li></ul></ul><ul><li>JNDI is used for maximum portability </li></ul>QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup(&quot;java:comp/env/jms/TrafficConFactory&quot;);
    23. 25. Accessing the Destination <ul><li>The Specific Queue or Topic </li></ul><ul><li>Retrieved via JNDI </li></ul><ul><ul><li>Specified in the Deployment Descriptor </li></ul></ul><ul><ul><li>Binding to a real Destination done at deploy time </li></ul></ul>Topic traffic = (Topic) ctx.lookup(&quot;java:comp/env/jms/TrafficTopic&quot;);
    24. 26. What the Java/API looks like // Create a connection factory TopicConnectionFactory factory; factory = (TopicConnectionFactory)jndi.lookup(&quot;TopicConnectionFactory&quot;); // 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(&quot; chat &quot;);
    25. 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();
    26. 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); ...
    27. 29. Break
    28. 30. Do the Book Raffle
    29. 31. Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul><ul><li>JMS and XA Integration </li></ul><ul><li>J2EE Connector Architecture </li></ul><ul><li>Service Oriented Architectures and Web Services </li></ul>
    30. 32. EJB Design Pattern Reminder create lookup remove 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
    31. 33. MessageDrivenBean EJB Container Publisher Bean EJB Container Subscriber Msg-driven Instance Database Durable Subscription Client App Publishes Acknowledges Delivers Stores
    32. 34. MessageDrivenBean <ul><li>Defined in EJB 2.x Specification </li></ul><ul><li>Benefits </li></ul><ul><ul><li>Simple to write </li></ul></ul><ul><ul><li>Allow for asynchronous execution </li></ul></ul>Container Msg-driven Bean Class JMS Provider Destination Msg-driven Bean instances Consumer
    33. 35. MessageDrivenBean <ul><li>Executes on receipt of a JMS message </li></ul><ul><ul><li>javax.jms.MessageListener interface </li></ul></ul><ul><li>Shares the following characteristics of stateless session bean </li></ul><ul><ul><li>Is stateless and relatively short- lived </li></ul></ul><ul><ul><li>Security </li></ul></ul><ul><ul><li>Transactions </li></ul></ul><ul><ul><li>Concurrency </li></ul></ul><ul><ul><li>Management </li></ul></ul><ul><ul><li>All the other services that EJBs enjoy! </li></ul></ul><ul><ul><li>Notable difference: No home or remote interface </li></ul></ul>
    34. 36. MessageDrivenBean Interface <ul><li>javax.ejb.MessageDrivenBean </li></ul><ul><ul><li>ejbCreate(), ejbRemove() </li></ul></ul><ul><ul><li>setMessageDrivenContext() </li></ul></ul><ul><li>Just like a usual javax.jms.MessageListner </li></ul><ul><ul><li>onMessage(javax.jms.Message) </li></ul></ul>
    35. 37. MessageDrivenContext <ul><li>get/setRollbackOnly() </li></ul><ul><li>getUserTransaction() </li></ul><ul><ul><li>For BMT only </li></ul></ul><ul><li>Others inherited from EJBContext Interface, but not allowed: </li></ul><ul><ul><li>getCallerPrincipal() </li></ul></ul><ul><ul><li>isCallerInRole() </li></ul></ul><ul><ul><li>getEJBHome(), getEJBLocalHome() </li></ul></ul>
    36. 38. Serialization and Concurrency <ul><li>Container Must Serialize all calls to an MDB </li></ul><ul><ul><li>ejbCreate(), ejbRemove(), etc </li></ul></ul><ul><ul><li>No need to be coded as re-entrant </li></ul></ul><ul><li>Concurrency </li></ul><ul><ul><li>Container May Launch Multiple Instances of an MDB </li></ul></ul><ul><ul><ul><li>No guarantee of order </li></ul></ul></ul><ul><ul><ul><li>“ Cancellation” Message May Arrive Before “Reservation” Message </li></ul></ul></ul>
    37. 39. MDB Example <ul><li>public class SubscriberMsgBean implements MessageDrivenBean { </li></ul><ul><li><… define ejbCreate(), ejbRemove() and </li></ul><ul><li>setMessageDrivenContext( MessageDrivenContext mdc) .. > </li></ul><ul><li>MessageDrivenContext mdc = null; </li></ul><ul><li>public void onMessage( Message inMessage) { </li></ul><ul><li>TextMessage msg = (TextMessage) inMessage; </li></ul><ul><li>try { </li></ul><ul><li>< look up JDBC database > </li></ul><ul><li>< store info from message in database > </li></ul><ul><li>} catch( Exception e) { </li></ul><ul><li>mdc. setRollbackOnly(); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
    38. 40. MDB Example – Deployment Descriptors <ul><li><message-driven> </li></ul><ul><li>... </li></ul><ul><li><ejb-class>SubscriberMsgBean</ejb-class> </li></ul><ul><li><transaction-type>Container</transaction-type> </li></ul><ul><li><jms-message-selector> </li></ul><ul><li>N ewsType='Metro/Region‘ </li></ul><ul><li></jms-message-selector> </li></ul><ul><li><message-driven-destination> </li></ul><ul><li><jms-destination-type> </li></ul><ul><li>javax.jms.Topic </li></ul><ul><li>< /jms-destination-type> </li></ul><ul><li><jms-subscription-durability> </li></ul><ul><li>durable </li></ul><ul><li></jms- subscription-durability> </li></ul><ul><li></message-driven-destination> </li></ul><ul><li>... </li></ul><ul><li></ message- driven> </li></ul>
    39. 41. MDB Example – Deployment Descriptors <ul><li><weblogic-enterprise-bean> </li></ul><ul><li><ejb-name>QueueMessageDriven</ejb-name> </li></ul><ul><li><message-driven-descriptor> </li></ul><ul><li><pool> </li></ul><ul><li><max-beans-in-free-pool> 20 </max-beans-in-free-pool> </li></ul><ul><li><initial-beans-in-free-pool> 1 </initial-beans-in-free-pool> </li></ul><ul><li></pool> </li></ul><ul><li><destination-jndi-name> sonicQueue </destination-jndi-name> </li></ul><ul><li><initial-context-factory> </li></ul><ul><li>com.sun.jndi.fscontext.RefFSContextFactory </li></ul><ul><li></initial-context-factory> </li></ul><ul><li><provider-url> </li></ul><ul><li>file://localhost/C:/temp/jndi/fileStore/ </li></ul><ul><li></provider-url> </li></ul><ul><li><connection-factory-jndi-name> </li></ul><ul><li>myJMSxaqcf </li></ul><ul><li></connection-factory-jndi-name> </li></ul>
    40. 42. Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul><ul><li>JMS and XA Integration </li></ul><ul><li>J2EE Connector Architecture </li></ul><ul><li>Service Oriented Architectures and Web Services </li></ul>
    41. 43. Distributed Transaction Processing (DTP) <ul><li>TM </li></ul>RM RM RM XA XA XA <ul><li>TM </li></ul>RM RM RM RM XA XA XA <ul><li>TM </li></ul>RM RM <ul><li>TM </li></ul>RM RM RM XA XA XA <ul><li>TM </li></ul>RM RM RM XA XA XA
    42. 44. A local instance of a DTP system <ul><li>TM </li></ul><ul><li>JMS Client </li></ul>RM RM
    43. 45. Local DTP zoom in EJB Application Server SonicMQ Client JMS Provider Transaction Manager JMS Client JMS XA API XA Resource
    44. 46. XA interfaces <ul><li>JMS XA SPI </li></ul><ul><ul><li>XAConnectionFactory </li></ul></ul><ul><ul><li>XAConnection </li></ul></ul><ul><ul><li>XASession </li></ul></ul><ul><ul><li>XAQueueConnectionFactory </li></ul></ul><ul><ul><li>XAQueueConnection </li></ul></ul><ul><ul><li>XAQueueSession </li></ul></ul><ul><ul><li>XATopicConnectionFactory </li></ul></ul><ul><ul><li>XATopicConnection </li></ul></ul><ul><ul><li>XATopicSession </li></ul></ul>
    45. 47. Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul><ul><li>JMS and XA Integration </li></ul><ul><li>J2EE Connector Architecture </li></ul><ul><li>Service Oriented Architectures and Web Services </li></ul>
    46. 48. J2EE Directions <ul><li>J2EE 1.3 </li></ul><ul><ul><li>Web Applications </li></ul></ul><ul><ul><li>Asynchronous </li></ul></ul><ul><ul><ul><li>JMS </li></ul></ul></ul><ul><ul><ul><li>MDB </li></ul></ul></ul><ul><ul><li>EJB 2.0 </li></ul></ul><ul><li>J2EE 1.4 </li></ul><ul><ul><li>SOA Platform </li></ul></ul><ul><ul><li>Web Services </li></ul></ul><ul><ul><ul><li>JAX-RPC </li></ul></ul></ul><ul><ul><ul><li>JSR-109 </li></ul></ul></ul><ul><ul><li>J2EE Connector Architecture </li></ul></ul><ul><ul><li>EJB 2.1 </li></ul></ul><ul><ul><ul><li>WSEI </li></ul></ul></ul>
    47. 49. J2EE Connector Architecture Overview <ul><li>Defines standard for connecting J2EE to enterprise information systems (EIS) </li></ul><ul><li>System contracts define interface specification with EIS </li></ul><ul><ul><li>Connection, Transaction, Security </li></ul></ul>Enterprise Information System Resource Adapter Application Server or EAI Framework System Contract EIS Interface
    48. 50. J2EE Connector Architecture Overview <ul><li>Resource adapters </li></ul><ul><ul><li>Implements the EIS side of the system contracts </li></ul></ul><ul><ul><li>System-level software drivers for connecting to an EIS </li></ul></ul><ul><ul><li>Enables vendors to create standardized connectors to EIS </li></ul></ul><ul><li>Common client interface </li></ul><ul><ul><li>Standard API for applications to interact with heterogeneous EIS </li></ul></ul>Enterprise Information System Resource Adapter Application Server or EAI Framework System Contract EIS Interface
    49. 51. Inbound Communication Model Resource Adapter JMS Destination Enterprise Java Beans Work Mgmt JMS Disp EJB Disp JCA Container WorkManager Connection Pool Manager Transaction Manager Security Manager
    50. 52. Agenda <ul><li>J2EE Message Driven Topology </li></ul><ul><li>JMS Overview </li></ul><ul><li>Using JMS With EJBs </li></ul><ul><li>JMS and XA Integration </li></ul><ul><li>J2EE Connector Architecture </li></ul><ul><li>Service Oriented Architectures and Web Services </li></ul>
    51. 53. Service-Oriented Architecture Global Enterprise Internet Web Service Credit Check Web Service Supplier Fulfill Service Web Service Invoicing Service Sales Service Special Orders Order Processing Regional Sales Partner App Inventory Lookup Customer App Partner App Check Inv Service Order Entry Service
    52. 54. Service-Oriented Architectures (SOA) <ul><li>System design methodology using existing application components </li></ul><ul><li>Applications expose functionality through service interfaces </li></ul><ul><ul><li>Loosely-coupled, asynchronous, coarse-grained </li></ul></ul><ul><li>Distributed across internal networks or the Internet </li></ul><ul><li>Web services </li></ul><ul><ul><li>Software services built on standards: SOAP, WSDL, UDDI, XML, HTTP </li></ul></ul>Architecture for a Distributed World
    53. 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)
    54. 56. Web Services Technology Stack XML-RPC (SOAP-RPC, JAX-RPC) XML Messaging (SOAP, ebXML,JAXM) Publication and Discovery (UDDI, ebXML Registry) Description Language (WSDL) Data Formatting (XML Dujour) Transport (HTTP, SMTP, TCP/IP) Quality of Service JMS, ebXML-MS, HTTPR
    55. 57. Connecting (Web) Services Together <ul><li>(Web) Services aren’t Islands of Themselves </li></ul><ul><li>Network of Cooperative Services </li></ul><ul><li>Interfaces, Discovery, and Data Formats are only part of the big picture </li></ul><ul><ul><li>Data transformation </li></ul></ul><ul><ul><li>Intelligent Routing based on content </li></ul></ul><ul><ul><li>End-to-end guaranteed delivery </li></ul></ul><ul><ul><li>Management, configuration, and auditing </li></ul></ul><ul><ul><li>Performance and scalability </li></ul></ul><ul><ul><li>Asynchronous and synchronous messaging </li></ul></ul><ul><ul><li>Security </li></ul></ul><ul><ul><li>Deployment tools </li></ul></ul>What Else Do You Need?
    56. 58. Standards Working Together... JAXM/RPC Client Apache Client Servlet Container .NET SOAP Client SOAP/HTTP Web Client SOAP/HTTP SOAP/HTTP SOAP/HTTP Internet JMS Messaging Backbone SOAP/HTTP SOAP/JMS SOAP/HTTP SOAP/JMS SOAP/HTTP SOAP/JMS JCA/EIS EJB Container JMS Client C++ Client JCA/EIS JMS message JMS message JMS message JMS message
    57. 59. Contact Information <ul><li>[email_address] </li></ul><ul><li>http://www.sonicsoftware.com </li></ul>Integrate with Ease. Extend at Will TM .
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×