This example is used to familiarize yourself with the development process of JMS.
The result is that a servlet sends a message to a message driven Bean (MDB. The server is glassfish3.1.
First, create some JMS resources, including connectionfactory and a queue. In this example, it is a ptp
Java Message Queue-JMS overview, java queue-jms1. What is JMS?
Java Message Service (JMS) is a Java platform-oriented Message-oriented middleware (MOM) API. It is used between two applications, or send messages in a distributed sy
Research on the Distributed System Based on JMS Message Middleware (2); Research on jms Message Middleware
In the previous article, we solved the communication problem between subsystems and ran a model project. Here we need to implement the server program in detail.
We run Spring on the server, use the IoC container
methods can be used to receive messages:Synchronization
If the synchronous method is used to receive messages, the message subscriber calls the receive () method. In receive (), a message does not arrive or the method is blocked until it reaches the specified time until the message is available.Asynchronous
To receive messages asynchronously, the
, JMS messages can consume messages in two ways.(1), Synchronization (synchronous)In the synchronous consumption information mode mode, the Subscriber/receiver receives the message by calling the receive () method. In the Receive () method, the thread blocks until the message arrives or the message does not arrive afte
messages can consume messages in two ways.(1), Synchronization (synchronous)In the synchronous consumption information mode mode, the Subscriber/receiver receives the message by calling the receive () method. In the Receive () method, the thread blocks until the message arrives or the message does not arrive after the specified time.(2), asynchronous (asynchrono
relational database is a software running on a computer or Server (such as Oracle, MySQL, or SQL Server ); the messaging system is also a software running on a computer or server (such as Apache ActiveMQ or IBM WebSphere MQ ). The above sentence not only points out what is the "message system", but also explains what is the role of JMS--JMS is very similar to JD
Jmsdeliverymode
In JMS, there are two transmission modes: Persistent mode and non-persistent mode. A persistent message should be sent "once and only once", which means that if the JMS provider fails, the message will not be lost; it will be sent again after the server returns to normal. A non-persistent
, you can use the same API to access MnS such as IBM MQSeries and JBossMQ.Many core concepts of JMS APIs are mapped to the underlying Messaging Server. Where:1. controlled Object (Administered Object ). They are the objects created by the Administrator for the JMS client. For example, Connection Factory is used to connect to the underlying message server and targ
; Message body: The data or payload carrying the application.---> Based on the type of payload, you can divide messages into several types, each carrying: simple text (textmessage), serializable objects (objectmessage), attribute collections (mapmessage), byte streams ( Bytesmessage), the original value stream (Streammessage), and a message with no payload.Message header (required): Contains the action sett
This article mainly from two aspects to tell:1. Why Use MDB2. Design principles for using MDBLet's take a look at how the messages are communicated.One component of the application sends a JMS message for the specified message purpose, and another component of the application reads the message from the
17) JMS: java Message Service (Java Message Service), jmsmessage
JMS is a standard, just like EJB, which has many open-source and commercial implementations. The specification corresponding to ms technology is jsr914. The implementation of the Specification is called jms
templateWhile JMS provides a common API for interacting with various brokers, it is not very convenient to use, so let's take a look at the code that interacts with the broker using the normal JMS API.2.2.1 sends a message to the broker code via the normal JMS API:ConnectionFactory cf =new ActiveMQConnectionFactory("t
/client directory) to Classpath, which requires you to start JBOSS before running HELLOWORLSJMS:run the sample code
Running HELLOWORLSJMS will have the following output:
Create Local JNDI Context successful
attempting to acquire connection factory "Jms/remoteconnectionfactory"
Found Connection Factory "Jms/remoteconnectionfactory" in JNDI
attempting to acquire destination "
The company's technology platform in the docking of IBM MQ message middleware with a broker, messages sent to MQ have more message header information:RHF2, resulting in the reception of the message is not working properly. Record how this problem is handled here.A parameter, targetclient, is provided in IBM MQ that can be used to control whether the
Use Apache Flume to read JMS Message Queuing messages. and write the message to the Hdfs,flume agent configuration such as the following:Flume-agent.conf#name the components in this agentagenthdfs.sources = Jms_sourceAgenthdfs.sinks = Hdfs_sinkAgenthdfs.channels = Mem_channel# Describe/configure The sourceAgentHdfs.sources.jms_source.type =
Use Apache Flume to read the JMS Message Queuing message and write the message to the Hdfs,flume agent configuration as follows:Flume-agent.conf#name the components in this agentagenthdfs.sources = Jms_sourceAgenthdfs.sinks = Hdfs_sinkAgenthdfs.channels = Mem_channel# Describe/configure The sourceAgentHdfs.sources.jms_
computer or server (such as Oracle, MySQL, or SQL Server) The messaging system is also a software that runs on a computer or server (such as Apache ACTIVEMQ or IBM WebSphere MQ). The above sentence not only points out what is the "message system", but also explains what the role of JMS--JMS is similar to JDBC: JDBC provides a set of public interfaces for accessi
application that sends or receives messages
Producer/Publisher: Create a client that sends messages
Consumer/Subscriber: The client that receives and processes the message
Message: Data content passed between applications
Message patterns: The way messages are passed between clients, topic and queue pa
method.4. JMS programming model in JMS, the generation of messages and the message is asynchronous. For consumption, JMS messages can consume messages in two ways.A subscriber or receiver calls the Receive method to receive a message, and the receive method blocks until it
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.