Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1 Graphic Section Divider.

Similar presentations


Presentation on theme: "Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1 Graphic Section Divider."— Presentation transcript:

1 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1 Graphic Section Divider

2 Easier Messaging with JMS 2.0 Nigel Deakin JMS 2.0 Specification Lead Oracle

3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 4 BOF WHAT’S NEXT FOR JMS? Nigel Deakin, John Ament 1730 Tues 24 Sept Parc 55 – Cyril Magnin I

5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 5 Java Message Service (JMS)  A Java API for sending and receiving messages  Many competing implementations  Two distinct API variants – Java SE applications – Java EE applications – adds additional features  JTA (XA) transactions  replaces async MessageListener with MDBs,  injection of connection factories and destinations using @Resource  (new!) injection and management of JMSContext objects

6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 6 What JMS is and isn't  A standard API – Not a messaging system in itself – Not a wire protocol  Defines Java API only – Doesn't define API for non-Java clients (e.g. C++, HTTP) - but many implementations do  An application API – Not (currently) an admin, management or monitoring API

7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 7 JMS 2.0  JMS 1.1 (2002) – dozens of implementations, both standalone and as part of a full Java EE provider  JMS 2.0 (2013) – launched in 2011 as JSR 343 – released in 2013 with Java EE 7 – available in Open Message Queue 5.0 (standalone JMS provider) and in GlassFish 4.0 (full Java EE provider) – other implementations announced or in progress

8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 8 What's new in JMS 2.0  Simpler and easier to use  New messaging features  Better Java EE integration – define differences between JMS in SE and EE more clearly – simpler resource configuration – standardized configuration of JMS MDBs  Minor corrections and clarifications

9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 9 JMS 2.0 Simpler and easier to use

10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 10 JMS API simplifications  Make minor simplifications to existing standard API where it won't break compatibility  Define new simplified API requiring fewer objects – JMSContext, JMSProducer, JMSConsumer – In Java EE, allow JMSContext to be injected and managed by the container Twin-track strategy

11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 11 Why did JMS 1.1 need simplifying?

12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 12 JMS 1.1: Sending a message @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { try { Connection connection = connectionFactory.createConnection(); try { Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(demoQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } finally { connection.close(); } } catch (JMSException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } 13 lines of code just to send a message

13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 13 JMS 1.1: Sending a message @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { try { Connection connection = connectionFactory.createConnection(); try { Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(demoQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } finally { connection.close(); } } catch (JMSException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } must create several intermediate objects

14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 14 JMS 1.1: Sending a message @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { try { Connection connection = connectionFactory.createConnection(); try { Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(demoQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } finally { connection.close(); } } catch (JMSException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } redundant and misleading arguments

15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 15 JMS 1.1: Sending a message @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { try { Connection connection = connectionFactory.createConnection(); try { Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(demoQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } finally { connection.close(); } } catch (JMSException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } must close resources after use!

16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 16 JMS 1.1: Sending a message @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { try { Connection connection = connectionFactory.createConnection(); try { Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(demoQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } finally { connection.close(); } } catch (JMSException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } all methods throw checked exceptions

17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 17 Minor simplifications to the existing standard API

18 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 18 Minor simplifications to the standard API  Methods on javax.jms.Connection to create a Session: – JMS 1.1 method remains – New method combines two parameters into one: – New method mainly for Java EE Simpler API to create a Session connection.createSession(transacted,acknowledgeMode) connection.createSession(sessionMode) connection.createSession() Session.SESSION_TRANSACTED Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE Session.DUPS_OK_ACKNOWLEDGE

19 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 19 Minor simplifications to the standard API  Make JMS objects implement java.jang.AutoCloseable – Connection – Session – MessageProducer – MessageConsumer – QueueBrowser  Requires Java SE 7 Simpler API to close JMS objects

20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 20 Minor simplifications to the standard JMS API  Make JMS objects implement java.jang.AutoCloseable – Connection, Session, MessageProducer, MessageConsumer, QueueBrowser Simpler API to close JMS objects @Resource(lookup = "jms/connFactory") ConnectionFactory cf; @Resource(lookup="jms/inboundQueue") Destination dest; public void sendMessage (String payload) throws JMSException { try ( Connection conn = connectionFactory.createConnection(); Session session = conn.createSession(); MessageProducer producer = session.createProducer(dest); ){ Message mess = sess.createTextMessage(payload); producer.send(mess); } catch(JMSException e){ // exception handling } } close() is called automatically at end of block Create closeable resources in a try-with- resources block

21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 21 Completely new simplified API

22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 22 Completely new simplified API Introducing JMSContext and JMSProducer @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessageNew(String payload) { try (JMSContext context = connectionFactory.createContext();){ context.createProducer().send(demoQueue, payload); } catch (JMSRuntimeException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } 13 lines reduced to 5

23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 23 @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessageNew(String payload) { try (JMSContext context = connectionFactory.createContext();){ context.createProducer().send(demoQueue, payload); } catch (JMSRuntimeException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } Completely new simplified API Introducing JMSContext and JMSProducer JMSContext combines Connection and Session Payload can be sent directly

24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 24 JMSContext (1/2)  A new object which encapsulates a Connection, a Session and an anonymous MessageProducer  Created from a ConnectionFactory  Call close() after use, or create in a try-with-resources block  Can also be injected (into a Java EE web or EJB application) JMSContext context = connectionFactory.createContext(sessionMode);

25 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 25 JMSContext (2/2)  Can also create from an existing JMSContext (to reuse its connection – Java SE only)  Used to create JMSProducer objects for sending messages  Used to create JMSConsumer objects for receiving messages  Methods on JMSContext, JMSProducer and JMSConsumer throw only unchecked exceptions JMSContext context2 = context1.createContext(sessionMode);

26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 26 JMSProducer  Messages are sent by creating a JMSProducer object – does not encapsulate a MessageProducer so is lightweight – supports method chaining for a fluid style  JMS 1.1  JMS 2.0 MessageProducer producer = session.createProducer(); producer.send(destination,message); JMSProducer producer = context.createProducer(); producer.send(destination,message);

27 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 27 JMSProducer  JMS 1.1  JMS 2.0 Setting message delivery options using method chaining context.createProducer().setDeliveryMode(DeliveryMode.NON_PERSISTENT). setPriority(1).setTimeToLive(1000).send(destination,message); MessageProducer producer = session.createProducer(); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); producer.setPriority(1); producer.setTimeToLive(1000); producer.send(destination,message);

28 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 28 JMSProducer  JMS 1.1 (need to set on the message)  JMS 2.0 (can also set on the JMSProducer) Setting message properties and headers context.createProducer().setProperty("foo","bar").send(destination,"Hello"); MessageProducer producer = session.createProducer(); TextMessage textMessage = session.createTextMessage("Hello); textMessage.setStringProperty("foo","bar"); producer.send(destination,message);

29 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 29 JMSProducer  Methods on JMSProducer to send a Message – send(Destination dest, Message message)  No need to create a Message – send(Destination dest, Map payload) – send(Destination dest, Serializable payload) – send(Destination dest, String payload) – send(Destination dest, byte[] payload)  Use methods on JMSProducer to set delivery options, message headers and message properties Sending message bodies directly

30 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 30 JMSConsumer  Messages are consumed by creating a JMSConsumer object – encapsulates a MessageConsumer – similar functionality and API to MessageConsumer  Synchronous  Asynchronous  Connection is automatically started (configurable) JMSConsumer consumer = context.createConsumer(destination); Message message = consumer.receive(1000); JMSConsumer consumer = context.createConsumer(destination); consumer.setMessageListener(messageListener);

31 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 31 JMSConsumer Receiving message bodies directly  Methods on JMSConsumer that return a Message – Message receive(); – Message receive(long timeout); – Message receiveNoWait();  Methods on JMSConsumer that return message body directly – T receiveBody(Class c); – T receiveBody(Class c, long timeout); – T receiveBodyNoWait(Class c); When consuming messages synchronously

32 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 32 JMSConsumer Receiving message bodies directly public String receiveMessage() throws NamingException { InitialContext initialContext = getInitialContext(); ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup("jms/connectionFactory"); Queue inboundQueue = (Queue)initialContext.lookup("jms/inboundQueue"); try (JMSContext context = connectionFactory.createContext();) { JMSConsumer consumer = context.createConsumer(inboundQueue); return consumer.receiveBody(String.class); }

33 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 33 Extracting the body from a message  Old way  New way In both the standard and simplified APIs Message message = consumer.receive(1000); TextMessage textMessage = (TextMessage) message; String body = textMessage.getText(); Message message = consumer.receive(1000); String body = message.getBody(String.class);

34 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 34 Injection of JMSContext objects into a Java EE web or EJB container @Inject @JMSConnectionFactory("jms/connectionFactory") private JMSContext context; @Resource(mappedName = "jms/inboundQueue") private Queue inboundQueue; public void sendMessage (String payload) { context.createProducer().send(inboundQueue, payload); }

35 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 35 Injection of JMSContext objects  Connection factory will default to platform default JMS  Specifying session mode  Specifying user and password (not for production use) into a Java EE web or EJB container @Inject private JMSContext context; @Inject @JMSConnectionFactory("jms/connectionFactory") @JMSSessionMode(JMSContext.AUTO_ACKNOWLEDGE) private JMSContext context; @Inject @JMSConnectionFactory("jms/connectionFactory") @JMSPasswordCredential(userName="admin",password="mypassword") private JMSContext context;

36 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 36 Injection of JMSContext objects  Injected JMSContext objects have a scope – In a JTA transaction, scope is the transaction – If no JTA transaction, scope is the request  JMSContext is automatically closed when scope ends  Inject two JMSContext objects within the same scope and you get the same object – if @JMSConnectionFactory, @JMSPasswordCredential and @JMSSessionMode annotations match – Makes it easier to use same session within a transaction into a Java EE web or EJB container

37 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 37 The four JMS APIs Simplified API Standard APILegacy queue-specific API Legacy topic-specific API Introduced in JMS 2.0JMS 1.1JMS 1.0 Main interfaces Connection Factory JMSContext JMSProducer JMSConsumer ConnectionFactory Connection Session MessageProducer MessageConsumer QueueConnection Factory QueueConnection QueueSession, QueueSender, QueueReceiver TopicConnection Factory TopicConnection TopicSession TopicProducer TopicSubscriber new and simplified slightly simplified deprecated

38 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 38 New messaging features

39 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 39 Delivery delay  Allows a JMS client to schedule the future delivery of a message  New method on MessageProducer  New method on JMSProducer  Sets minimum time in ms from that a message should be retained by the messaging system before delivery to a consumer  Why? If the business requires deferred processing, e.g. end of day In both the standard and simplified APIs public JMSProducer setDeliveryDelay(long deliveryDelay) public void setDeliveryDelay(long deliveryDelay)

40 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 40 Async send  Send a message and return immediately without blocking until an acknowledgement has been received from the server.  Instead, when the acknowledgement is received, an asynchronous callback will be invoked  New methods on MessageProducer  Feature also available on JMSProducer  Why? Allows thread to do other work whilst waiting for the acknowledgement In both the standard and simplified APIs messageProducer.send(message,completionListener)

41 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 41 Async send  Application specifies a CompletionListener instance In both the standard and simplified APIs public interface CompletionListener { void onCompletion(Message message); void onException(Message message, Exception exception); }

42 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 42 Better handling of "poison" messages: Make JMSMXDeliveryCount mandatory  JMS 1.1 defines an optional JMS defined message property JMSXDeliveryCount. – When used, this is set by the JMS provider when a message is received, and is set to the number of times this message has been delivered (including the first time). The first time is 1, the second time 2, etc  JMS 2.0 will make this mandatory  Why? Allows app servers and applications to handle "poisonous" messages better In both the standard and simplified APIs

43 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 43 Multiple consumers on a topic subscription

44 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 44 How topics work in JMS 1.1 Topic Producer Subscription Consumer Each message is copied to every subscription In JMS 1.1, each subscription has a single consumer Subscription may be persisted (durable) or memory-only (non-durable) Subscription Consumer Subscription Consumer

45 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 45 Making topic subscriptions more scalable  In JMS 1.1 a topic subscription can have only one consumer – only one thread can process messages – limits scalability  JMS 2.0 introduces shared subscriptions – a new type of topic subscription which may have multiple consumers – allows the work of processing messages from a topic subscription to be shared amongst multiple threads, and multiple JVMs

46 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 46 Shared subscriptions in JMS 2.0 Topic Producer Consumer Shared Subscription Each message is copied to every subscription A shared subscription may have multiple consumers Subscription may be persisted (durable) or memory-only (non-durable) Unshared subscription Consumer Each message on the shared subscription is delivered to only one consumer

47 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 47 JMS 1.1 API for topic subscriptions In the standard API (Session) Non-durable subscriptions createConsumer( Destination destination) Creates a new non-durable subscription Creates a consumer on that subscription Durable subscriptions createDurableConsumer( Topic topic, String name) Looks for an existing durable subscription for the specified name/ clientId If no such subscription exists, creates one Creates a consumer on that subscription

48 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 48 JMS 2.0 API for topic subscriptions In both the standard and simplified APIs (Session and JMSContext) Unshared subscriptionsShared subscriptions Non-durable subscriptions createConsumer( Destination destination) createSharedConsumer( Topic topic, String name) Durable subscriptions createDurableConsumer( Topic topic, String name) createSharedDurableConsumer( Topic topic, String name) – For unshared durable subscriptions, clientId must be set and is used to identify subscription – For shared subscriptions, clientId is optional. If set, it is used to identify subscription.

49 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 49 Easier definition of JMS resources in Java EE (This is actually part of Java EE 7)

50 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 50 Easier definition of JMS resources in Java EE  Java EE and JMS recommend applications should obtain JMS ConnectionFactory and Destination resources by lookup from JNDI  Keeps application code portable  Creating these resources is a burden on the deployer, and is non- standard The problem @Resource(lookupName = "jms/inboundQueue") private Queue inboundQueue;

51 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 51 Platform default connection factory  if you simply want to use the application server's built-in JMS provider, with no special settings: Making the simple case simple @Resource(lookup="java:comp/defaultJMSConnectionFactory") ConnectionFactory myJMScf;

52 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 52 Easier definition of JMS resources in Java EE  Application may specify the JMS connection factories and JMS destinations that it needs using annotations New feature in Java EE 7 @JMSDestinationDefinition( name = "java:global/jms/myQueue", interfaceName = "javax.jms.Queue", destinationName = "demoQueue" ) @JMSConnectionFactoryDefinition( name="java:global/jms/myCF" ) JNDI name queue/ topic name

53 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 53 Easier definition of JMS resources in Java EE  Can specify additional standard or provider-specific properties New feature in Java EE 7 @JMSDestinationDefinition( name = "java:global/jms/myQueue", interfaceName = "javax.jms.Queue", destinationName = "demoQueue" ) @JMSConnectionFactoryDefinition( name="java:global/jms/myCF", maxPoolSize = 30, minPoolSize= 20, properties = { "addressList=mq://localhost:7676", "reconnectEnabled=true" } ) standard properties non- standard properties

54 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 54 Easier definition of JMS resources in Java EE  Multiple definitions of same type must be wrapped in collection annotations (due to restriction in how Java annotations work) New feature in Java EE 7 @JMSDestinationDefinitions({ @JMSDestinationDefinition( name = "java:global/jms/myQueue1", interfaceName = "javax.jms.Queue", destinationName = "demoQueue1" ), @JMSDestinationDefinition( name = "java:global/jms/myQueue2", interfaceName = "javax.jms.Queue", destinationName = "demoQueue2" ) }) @JMSConnectionFactoryDefinitions({ @JMSConnectionFactoryDefinition( name="java:global/jms/myCF1" ), @JMSConnectionFactoryDefinition( name="java:global/jms/myCF2" ) })

55 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 55 Easier definition of JMS resources in Java EE  Alternatively application may specify the JMS connection factories and JMS destinations that it needs in the XML deployment descriptor New feature in Java EE 7 java:global/jms/myQueue javax.jms.Queue demoQueue java:global/jms/myCF 30 20 addressList mq://localhost:7676 reconnectEnabled true

56 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 56 Easier definition of JMS resources in Java EE  Resources configured in this way must be in one of the following namespaces: – java:comp – may be used within same component only – java:module – may be used within same module only – java:app – may be used within same application only – java:global – may be used within any application  May be referenced just like any other resource (e.g. @Resource ) Available namespaces @Resource(lookup="java:global/jms/myCF") ConnectionFactory myCF;

57 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 57 More standardized configuration of JMS MDBs Joint effort with JSR 345 (EJB 3.2)

58 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 58 More standardized configuration of JMS MDBs  Configuration of JMS MDBs is surprisingly non-standard  EJB 3.1 does not define how to specify – JNDI name of queue or topic (using annotation) – JNDI name of connection factory – clientID – durableSubscriptionName  EJB 3.1 does not define how topic messages delivered to clustered MDBs

59 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 59 More standardized configuration of JMS MDBs  Can also be configured in ejb-jar.xml New activation property to specify the queue or topic @MessageDriven(activationConfig = { @ActivationConfigProperty( propertyName = "destinationLookup", propertyValue = "jms/myTopic"),... })

60 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 60 More standardized configuration of JMS MDBs  Can also be configured in ejb-jar.xml New activation property to specify the connection factory @MessageDriven(activationConfig = { @ActivationConfigProperty( propertyName = "connectionFactoryLookup", propertyValue = "jms/myCF"),... })

61 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 61 More standardized configuration of JMS MDBs  Surprisingly, these have never been standardized before New activation properties to specify durable subscriptions @MessageDriven(activationConfig = { @ActivationConfigProperty( propertyName = "subscriptionDurability", propertyValue = "Durable"), @ActivationConfigProperty( propertyName = "clientId", propertyValue = "myClientID"), @ActivationConfigProperty( propertyName = "subscriptionName", propertyValue = "MySub"),... }) clientId optional even for durable subscriptions

62 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 62 What’s new in JMS 2.0  Simplicity and ease of use  New messaging features – multi-threaded topic subscribers – delivery delay – async send  Better Java EE integration – simpler resource configuration – standardized configuration of JMS MDBs  Minor corrections and clarifications Summary

63 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 63 Try JMS 2.0  JMS 2.0 in a standalone provider (for Java SE applications) – Open Message Queue 5.0 – mq.java.net/ mq.java.net/  JMS 2.0 in a full Java EE 7 application server  GlassFish 4.0  glassfish.java.net/ glassfish.java.net/  Try other implementations as they are released  See also jms-spec.java.net for lots of useful linksjms-spec.java.net JMS 2.0, EJB 3.2 and Java EE 7

64 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 64 Any questions? More time for discussion at the BOF What’s Next for JMS? Nigel Deakin and John Ament 1730 Tues 24 Sept Parc 55 – Cyril Magnin I

65 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 65


Download ppt "Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1 Graphic Section Divider."

Similar presentations


Ads by Google