<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-58847982105928357</id><updated>2024-09-08T07:37:10.521-07:00</updated><title type='text'>JMS</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jms-glassfish.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/58847982105928357/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://jms-glassfish.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mishu</name><uri>http://www.blogger.com/profile/05804936508701984555</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-58847982105928357.post-6127823109063159018</id><published>2012-04-08T08:29:00.000-07:00</published><updated>2013-12-19T10:44:22.409-08:00</updated><title type='text'>JMS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span id=&quot;internal-source-marker_0.47866279477151263&quot; style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Why do we need Message-based systems ex: JMS?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Message-based
 solutions are playing an increasingly important role nowadays, as more 
and more systems need to be integrated together and need to communicate 
with each other in a loosely-coupled manner. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;In
 a message-based system, the communication among application components 
(producers and consumers) is mediated by a message service provider 
instead of direct communication b/w application components in a 
client-server model. As a result of this, a message service provider is 
sometimes referred to as a Message Oriented Middleware (MOM). The 
producer creates a message that contains relevant data, and sends it to a
 destination resource maintained by the message service provider. The 
message is then routed to consumer components that are registered to the
 specific destination.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Another
 distinct feature of a message-based system is that the message service 
provider effectively makes the communication between producers and 
consumers asynchronous. When a producer sends a message, consumers do 
not need to be available because the message service provider can 
persist the message until the consumer becomes available. In fact, the 
producer and consumer do not need to have any knowledge of each other, 
as long as the message is in a format that is agreed upon. This feature 
further decouples the producers and consumers.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;What is JMS?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;JMS
 defines a standard Java API for application components to create, send,
 receive, and process messages. It also provides a standard API that 
simplifies how application components interact with a JMS-compliant 
message service provider (JMS provider for short).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;It
 defines the connection factory and destinations of the JMS provider in 
the form of administered objects, which can be registered in a JNDI 
naming service. An application component can use the standard JNDI API 
to perform a lookup operation to retrieve these resources. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;JMS defines the two messaging approaches as follows:&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Point-to-Point (PTP):&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;
 A producer sends messages to a queue destination, which retains the 
messages until they are successfully routed to a consumer. Furthermore, 
each message is received by only one consumer.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Publish/Subscribe (Pub/Sub):&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;
 A producer sends messages to a topic destination. By default, the topic
 does not retain these messages. Instead, it immediately routes them to 
all the consumers registered for the topic. Due to this, if a message 
arrives at a topic when there is no active consumer, the message will be
 lost. To address this, JMS allows a consumer to be registered to the 
topic as durable subscriber. In this case, the JMS provider will retain 
the messages for this consumer until it becomes available.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;The
 JMS API became an integral part of the Java EE since version 1.3 as the
 standard to integrate with messaging systems. Subsequent Java EE 
revisions further enhanced the JMS API and messaging system integration 
in the following areas:&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Message-Driven Beans (MDB):&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;
 An MDB is a container-managed component that can asynchronously consume
 messages sent to a JMS destination. Due to this, we can consider an MDB
 as an asynchronous message listener component. The application server&#39;s
 MDB container provides services for MDBs such as life cycle management,
 instance pooling and naming services. These services eliminate a lot of
 boiler-plate code necessary to create a messae listener object. Due to 
this, when implementing an MDB, the developer only needs to focus on the
 logic about how to process messages delivered to the MDB. Furthermore, 
the MDB container&#39;s instance pooling service can significantly improve 
the throughput of processing messages routed to a specific MDB.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Java Connector Architecture (JCA):&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;
 Through JCA resource adapters, JMS providers can be easily integrated 
into different application servers. Once integrated, application 
components can treat them as standard JCA resources, and interact with 
the resources in a provider-independent manner.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 19px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Setting up GlassFish (Oracle Java EE implementation) for JMS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Before
 we start writing code to take advantage of the JMS API, we need to set 
up a JMS connection factory, a message queue, and a message topic which 
we will do using GlassFish server.&lt;/span&gt;&lt;br /&gt;
&lt;h2 dir=&quot;ltr&quot;&gt;

&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 19px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;1. Setting up a JMS connection factory&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;The
 easiest way to set up a JMS connection factory is via GlashFish&#39;s web 
console. Web console can be accessed by starting our domain, by entering
 the following command in the command line:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt; $&amp;gt; asadmin start-domain domain1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Then point the browser to http://localhost:4848&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNqRNEwwjYpQ0vAF1k8xqU6sQzpMhgq73O-mLnBs_651bqn9mDmpyZcofhO2rPKkNTctjbEeStdQv5ycmgE3av7807B9gvhugj-uNYEFZyjTPemcXMQmpFDdj5HMA96OhS0NnHXGp5tQ/s1600/pic1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNqRNEwwjYpQ0vAF1k8xqU6sQzpMhgq73O-mLnBs_651bqn9mDmpyZcofhO2rPKkNTctjbEeStdQv5ycmgE3av7807B9gvhugj-uNYEFZyjTPemcXMQmpFDdj5HMA96OhS0NnHXGp5tQ/s640/pic1.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;A
 connection factory can be added by expanding the Resources node in the 
tree at the left-hand side of the web console, expanding the JMS 
Resources node and clicking on the Connection Factories node, then 
clicking on the New... button in the main area of the web console.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaI7jLC5XsTPdj3bSrF8R835KpHLSjhaWGtkimZOEt-OFBbQdOISHSvbYhvBoR-Jbsl7VpKvUzgqPNV6mQf1Rb1j1isYyl_qWnk7hvB6xmGcOa9sNkz5e1JPAtm5JLOFCyI6w-6KviPA/s1600/jms+pic2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaI7jLC5XsTPdj3bSrF8R835KpHLSjhaWGtkimZOEt-OFBbQdOISHSvbYhvBoR-Jbsl7VpKvUzgqPNV6mQf1Rb1j1isYyl_qWnk7hvB6xmGcOa9sNkz5e1JPAtm5JLOFCyI6w-6KviPA/s640/jms+pic2.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Only
 thing we need to do is enter a Pool Name and pick a Resource Type for 
our connection factory. It is always a good idea to use a Pool Name 
starting with &quot;jms/&quot; when picking a name for JMS resources. This way JMS
 resources can be easily identified when browsing a JNDI tree.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;In
 the text field labeled Pool Name, enter jms/JMSPool. Our code
 examples later in this chapter will use this JNDI name to obtain a 
reference to this connection factory.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;The Resource Type drop-down menu has three options:&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;javax.jms.TopicConnectionFactory&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; - used to create a connection factory that creates JMS topics for JMS clients using the pub/sub messaging domain&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;javax.jms.QueueConnectionFactory&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; - used to create a connection factory that creates JMS queues for JMS clients using the PTP messaging domain&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;javax.jms.ConnectionFactory&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; - used to create a connection factory that creates either JMS topics or JMS queues&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;For
 our example, we will select javax.jms.ConnectionFactory. This way we 
can use the same connection factory for all our examples, those using 
the PTP messaging domain and those using the pub/sub messaging domain. 
Enter description for our connection factory if you wish and then we 
must click on the OK button for the changes to take effect.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Calibri; font-size: 15px;&quot;&gt;We should then see our newly created connection factory listed in the main area of the GlashFish web console.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2 dir=&quot;ltr&quot;&gt;

&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 19px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;2. Setting up a JMS message queue&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;A
 JMS message queue can be added by expanding the Resources node in the 
tree at the left-hand side of the web console, expanding the JMS 
Resources node and clicking on the Destination Resources node, then 
clicking on the New... button in the main area of the web console.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik8_3ew_T3SuWYUe4WDWboCN9-xX14EWlS1N8Sngzsq-S0m-92b5g1C7l2SG5NfHKUg4vhu9RREeXvDuIQRDafIo_rh8KgDOQox-3-qhYRqhlHG3kaC7TKmA9WlitaD937unsVYI8geg/s1600/jms+pic3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik8_3ew_T3SuWYUe4WDWboCN9-xX14EWlS1N8Sngzsq-S0m-92b5g1C7l2SG5NfHKUg4vhu9RREeXvDuIQRDafIo_rh8KgDOQox-3-qhYRqhlHG3kaC7TKmA9WlitaD937unsVYI8geg/s640/jms+pic3.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;In
 our example, the JNDI name of the message queue is jms/Queue. The 
resource type for message queues must be javax.jms.Queue. Additionally, a
 Physical Destination Name must be entered. In this example, we use 
Queue1 as the value for this field. After clicking on the New... button,
 entering the appropriate information for our message queue, and 
clicking on the OK button, we should see the newly created queue.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri; font-size: 19px; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Calibri; font-size: 19px; font-weight: bold;&quot;&gt;3. Setting up a JMS message topic&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Setting up a JMS message topic in GlashFish is very similar to setting up a message queue.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;In
 the GlashFish web console, expand the Resources node in the tree at the
 left hand side, then expand the JMS Resouces node and click on the 
Destination Resources node, then click on the New... button in the main 
area of the web console.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOfHQ0u_yvzv0rH9Ch0CGUhnuv1SxchDaFpBhLBWkGJ5nl6dn0XVlgKsML_V3xvk40IaHVJ1Hd9D6Nj_AHXILn_r-o6dmuVRy0UV6Yv_kTJz1Isblr5NQf0jKc14Oc4NOHnBplR3Dc3A/s1600/jms+pic4.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOfHQ0u_yvzv0rH9Ch0CGUhnuv1SxchDaFpBhLBWkGJ5nl6dn0XVlgKsML_V3xvk40IaHVJ1Hd9D6Nj_AHXILn_r-o6dmuVRy0UV6Yv_kTJz1Isblr5NQf0jKc14Oc4NOHnBplR3Dc3A/s640/jms+pic4.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Our
 examples will use a JNDI Name of jms/Topic. As this is a message topic,
 Resource Type must be javax.jms.Topic. The Description field is 
optional. The Physical Destination Name property is required. For our 
example, we will use Topic1 as the value for this property.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;After clicking on the OK button, we can see our newly created message topic.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Now
 that we have set up a connection factory, a message queue, and a 
message topic, we are ready to start writing code using the JMS API.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Sample PTP Program&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Prequisites:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;1. Make sure that you have started the server. &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: italic; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;(asadmin start-domain domain1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;2. ConnectionFactory and Queue have been created.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.freefilehosting.net/simplequeuereceiver&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;&quot;&gt;http://www.freefilehosting.net/simplequeuereceiver&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.freefilehosting.net/simplequeuesender&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;&quot;&gt;http://www.freefilehosting.net/simplequeuesender&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Sample Pub/Sub Program&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Prequisites:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;1. Make sure that you have started the server. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: italic; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;(asadmin start-domain domain1)&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;2. ConnectionFactory and Topic have been created.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.freefilehosting.net/simpletopicpublisher&quot; id=&quot;internal-source-marker_0.47866279477151263&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;&quot;&gt;http://www.freefilehosting.net/simpletopicpublisher&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.freefilehosting.net/simpletopicsubscriber&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;&quot;&gt;http://www.freefilehosting.net/simpletopicsubscriber&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.freefilehosting.net/textlistener&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;&quot;&gt;http://www.freefilehosting.net/textlistener&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span id=&quot;internal-source-marker_0.47866279477151263&quot; style=&quot;background-color: transparent; color: black; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Alternatively Complete project is available at&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.freefilehosting.net/jms&quot; id=&quot;internal-source-marker_0.47866279477151263&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #1155cc; font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;&quot;&gt;http://www.freefilehosting.net/jms&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jms-glassfish.blogspot.com/feeds/6127823109063159018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jms-glassfish.blogspot.com/2012/04/jms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/58847982105928357/posts/default/6127823109063159018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/58847982105928357/posts/default/6127823109063159018'/><link rel='alternate' type='text/html' href='http://jms-glassfish.blogspot.com/2012/04/jms.html' title='JMS'/><author><name>Mishu</name><uri>http://www.blogger.com/profile/05804936508701984555</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNqRNEwwjYpQ0vAF1k8xqU6sQzpMhgq73O-mLnBs_651bqn9mDmpyZcofhO2rPKkNTctjbEeStdQv5ycmgE3av7807B9gvhugj-uNYEFZyjTPemcXMQmpFDdj5HMA96OhS0NnHXGp5tQ/s72-c/pic1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>