<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=JMS</id>
	<title>JMS - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=JMS"/>
	<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=JMS&amp;action=history"/>
	<updated>2026-04-16T19:04:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://luminoussheep.net/mediawiki/index.php?title=JMS&amp;diff=51&amp;oldid=prev</id>
		<title>Martin: Created page with &quot;* Typically used as an asynchronous communication mechanism - loosely coupled * point to point =&gt; queue based (typically) one receiver - only one receiver receives the message...&quot;</title>
		<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=JMS&amp;diff=51&amp;oldid=prev"/>
		<updated>2021-09-14T21:23:46Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;* Typically used as an asynchronous communication mechanism - loosely coupled * point to point =&amp;gt; queue based (typically) one receiver - only one receiver receives the message...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;* Typically used as an asynchronous communication mechanism - loosely coupled&lt;br /&gt;
* point to point =&amp;gt; queue based (typically) one receiver - only one receiver receives the message&lt;br /&gt;
* publish subscribe =&amp;gt; topics =&amp;gt; multiple receivers - all receivers receive the message&lt;br /&gt;
&lt;br /&gt;
* JMS application&lt;br /&gt;
** JMS Client - application&lt;br /&gt;
** JMS Provider - routing and delivery of mesages - typically one per JMS application&lt;br /&gt;
&lt;br /&gt;
== Message broker ==&lt;br /&gt;
* routing&lt;br /&gt;
* transactions&lt;br /&gt;
* reliable delivery&lt;br /&gt;
Optional:&lt;br /&gt;
* message priority&lt;br /&gt;
* ordering&lt;br /&gt;
* message transformation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Synchronous messaging ==&lt;br /&gt;
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/QueueRequestor.html&lt;br /&gt;
&lt;br /&gt;
http://blogs.sun.com/fkieviet/entry/request_reply_from_an_ejb&lt;br /&gt;
&lt;br /&gt;
Which discuses issues with transactions within an EJB and needing to commit the message to the JMS queue.&lt;br /&gt;
&lt;br /&gt;
= Sender = &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@Resource(mappedName=&amp;quot;FooJMSFactory&amp;quot;)&lt;br /&gt;
private ConnectionFactory cf;&lt;br /&gt;
@Resource(mappedName=&amp;quot;FooTopic&amp;quot;)&lt;br /&gt;
private Topic topic;&lt;br /&gt;
&lt;br /&gt;
public void send() {&lt;br /&gt;
  Connection con = cf.createConnection();&lt;br /&gt;
  Session session = con.createSession(true, Session.AUTO_ACKNOWLEDGE); // should be ignored and handled by container&lt;br /&gt;
  MessageProducer producer = session.createProducer(topic);&lt;br /&gt;
  TextMessage msg = session.createTextMessage();&lt;br /&gt;
  msg.setText(&amp;quot;foo&amp;quot;);&lt;br /&gt;
  producer.send(msg);&lt;br /&gt;
  connect.close();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Types of message:&lt;br /&gt;
# TextMessage&lt;br /&gt;
# MapMessage&lt;br /&gt;
# ObjectMessage &lt;br /&gt;
# StreamMessage&lt;br /&gt;
# BytesMessage&lt;br /&gt;
&lt;br /&gt;
= MDB =&lt;br /&gt;
Reference http://download.oracle.com/docs/cd/B25221_04/web.1013/b14428/mdb30cfg.htm&lt;br /&gt;
&lt;br /&gt;
* Must have @MessageDriven or deployment descriptor&lt;br /&gt;
** mapped name element points to the queue/topic or may use ActivationConfigProperty&lt;br /&gt;
* class must be public - not final&lt;br /&gt;
* must have no arg public constructor&lt;br /&gt;
* must no have a finalize() method&lt;br /&gt;
* should implement the interface MessageListener&lt;br /&gt;
** or interface for specific message provider - now JCA support JMS more flexibility - typically a different type of message parameter&lt;br /&gt;
* &amp;#039;&amp;#039;no longer needs to implement MessageDriventBean&amp;#039;&amp;#039;&lt;br /&gt;
** can declare the messaging-type - listener interface in the deployment descriptor&lt;br /&gt;
&lt;br /&gt;
* @ActivationConfigProperty - more advanced configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@MessageDriven(mappedName=&amp;quot;jms/Topic&amp;quot;,activationConfig=&lt;br /&gt;
 {@ActivationConfigProperty(propertyName=&amp;quot;connectionFactoryJndiName&amp;quot;, propertyValue=&amp;quot;jms/TopicConFact&amp;quot;),&lt;br /&gt;
  @ActivationConfigProperty(propertyName=&amp;quot;destinationName&amp;quot;,           propertyValue=&amp;quot;jms/Topic&amp;quot;),&lt;br /&gt;
  @ActivationConfigProperty(propertyName=&amp;quot;destinationType&amp;quot;,           propertyValue=&amp;quot;javax.jms.Topic&amp;quot;),&lt;br /&gt;
  @ActivationConfigProperty(propertyName=&amp;quot;messageSelector&amp;quot;,           propertyValue=&amp;quot;Header = ’Important’&amp;quot;),&lt;br /&gt;
  @ActivationConfigProperty(propertyName=&amp;quot;acknowledgeMode&amp;quot;,           propertyValue=&amp;quot;Auto-acknowledge&amp;quot;),&lt;br /&gt;
  @ActivationConfigProperty(propertyName=&amp;quot;subscriptionDurability&amp;quot;,    propertyValue=&amp;quot;Durable&amp;quot;)&lt;br /&gt;
 })&lt;br /&gt;
&lt;br /&gt;
public class XMessageBean implements MessageListener {&lt;br /&gt;
  @Resource&lt;br /&gt;
  private MessageDrivenContext mdc;&lt;br /&gt;
  &lt;br /&gt;
  public void onMessage(Message m) {&lt;br /&gt;
&lt;br /&gt;
  // error mdc.setRollbackOnly();  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MessageListener method ==&lt;br /&gt;
* must be public void&lt;br /&gt;
* must not be final or static&lt;br /&gt;
* must have only argument - Message&lt;br /&gt;
&lt;br /&gt;
== MessageDrivenContext ==&lt;br /&gt;
Extends EJBContext adds nothing&lt;br /&gt;
&lt;br /&gt;
== ActivationConfigProperty ==&lt;br /&gt;
=== subscriptionDurability ===&lt;br /&gt;
Durable = messages are kept until bean is available&lt;br /&gt;
NonDurable = messages are lost if bean is unavailable&lt;br /&gt;
&lt;br /&gt;
== Message Linking ==&lt;br /&gt;
Allows routing to a specific MDB within same deployment&lt;br /&gt;
* deployment descriptor: message-destination-link - not supported in annotations&lt;br /&gt;
* can be used to define logical queues and map at deployment descriptor time &lt;br /&gt;
* JCA can use to route inbound messages to MDB&lt;br /&gt;
* container may bypass JMS provider - must still adhere to contract&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JMS &amp;amp; JCA ==&lt;br /&gt;
As of JCA 1.5 there is a standard way of plugging in a JMS provider into a Application Server.&lt;br /&gt;
Project to do so for 1.5 and 1.4 here: [http://java.sun.com/j2ee/connector/]&lt;/div&gt;</summary>
		<author><name>Martin</name></author>
	</entry>
</feed>