1, Singleconnectionfactory: The request to establish a JMS server link will always return the same link, and the Close method call of connection will be ignored. ( org.springframework.jms.connection. singleconnectionfactory)2, Cachingconnectionfactory: inherited the singleconnectionfactory, so it has all the functions of singleconnectionfactory, and it also added a cache function, It can cache sessions, MessageProducer, and Messageconsumer. We use Cachingconnectionfactory as an example. (org.spr
First on the official web download related software: Rabbitmq-server-3.7.4.exe + Erlang for Windows (Windows environment), and then installed on the OK
To install page management features:
CMD to under RABBITMQ directory: D:\Program files\rabbitmq server\rabbitmq_server-3.7.4\sbin, input rabbitmq-plugins.bat enable Rabbitmq_management, run, and then through access: http://127.0.0.1:15672/will be able to see the relevant page, account password is: Guest, guest
Effect Chart:
First, the basic ope
Connect to the factory and implement the DataSource Interface
Package skydev. modules. data;Import java. SQL .*;Import javax. SQL. DataSource;Import java. io. PrintWriter;Public class ConnectionFactory implements DataSource {Private String userName;Private String password;Private String driverName;Private String url;Private java. SQL. Connection connection;/*** Create a new connection instance based on the set connection Parameters* @ Retur
The consolidates RABBITMQ in spring-boot using pure annotations, as follows
@Configuration public class Rabbitmqconfig {@Bean (value = "pmsmqconnectionfactory") public connectionfactory PmsM
Qconnectionfactory () {cachingconnectionfactory connectionfactory=new cachingconnectionfactory ();
Connectionfactory.setaddresses (pmsmqserveraddress);
Connectionfactory.setvirtualhost (Pmsmqs
Data | Database When we do information systems, we have to access the database, I recently took over a project, the project team decided to write in Java, I am responsible for the design and coding of the data layer, in order to improve the reuse of code and improve project development efficiency. We have developed a common database connection and the completion of basic operations of the class library, personally think that this class in the MIS system still has a certain value, so summed up, i
implementation. The dependencies used are managed using MAVEN, depending on the following:
Activemq Ready
Since it is the use of Apache ACTIVEMQ as a JMS implementation, then first we should go to the Apache online download activemq (http://activemq.apache.org/ download.html), after decompression run its bin directory under the Activemq.bat file start Activemq. Configure ConnectionFactory
ConnectionFactory
4.1 Steps to develop JSM broadly speaking, a JMS application is a few JMS clients exchanging messages, and developing a JMS client application consists of the following steps:Using Jndi to get ConnectionFactory object;Create connection objects with ConnectionFactory;Create one or more JMS sessions with the connection object;
Using Jndi to get target queue or Subject object, namely destination object;Create
# # Ready# # Target Understand the Spring AMQP core code# # Pre-Knowledge rabbitmq Getting Started # # Related Resources Quick tour for the impatient:gordon.study.rabbitmq.springamqp.Impatient. Java # # # Analysis # # ConnectionFactory Analysis org.springframework.amqp.rabbit.connection.ConnectionFactory is the connection factory interface defined by Spring AMQP and is responsible for creating the connection. Note that the RabbitMQ client also has a c
for waiting to be read)
JMS topic (A mechanism that supports sending messages to multiple subscribers)
3. JMS Object Model
The Connection factory (connectionfactory) client uses Jndi to find the connection factory and then creates a JMS connection using the connection factory.
A JMS connection represents an active connection between the JMS client and the server side, which is established by the client by invoking the connection
interfaces that Sun has defined to unify the vendor's interface specification. 2. JMS Architecture
Described below: JMS providers (implementations of JMS, such as Activemq jbossmq, etc.) JMS clients (Programs or objects that use the provider to send messages, for example, in 12306, responsible for sending a ticket message to the processing queue to solve the ticket-purchase peak problem, Programs that send messages to queues and programs that get messages from queues are called customers. JMS p
when we use it, and here we use Apache's ACTIVEMQ as its implementation. The dependencies used are managed using MAVEN. Detailed dependencies such as the following: ACTIVEMQ Preparationsince the Apache ACTIVEMQ is used as the implementation of JMS, we should first download the Apache websiteActiveMQ (http://activemq.apache.org/download.html), perform an extract after executing its bin folder under the Activemq.bat file to start Activemq.Configure Connec
supports the immediate flag, so we focus on the mandatory flagthe role of mandatory:When the mandatory flag bit is set to true, if Exchange cannot find a suitable queue store message based on its type and message Routingkey, the broker invokes the Basic.return method to return the message to the producer; When mandatory is set to false, the broker will discard the message directly; in layman's words, the mandatory flag tells the broker that the proxy server will send the message to a queue at l
*/import javax. jms. connection; import javax. jms. connectionFactory; import javax. jms. deliveryMode; import javax. jms. destination; import javax. jms. messageProducer; import javax. jms. session; import javax. jms. textMessage; import org. apache. activemq. activeMQConnection; impo Rt org. apache. activemq. activeMQConnectionFactory; public class Sender {private static final int SEND_NUMBER = 5; public static void main (String [] args) {//
, the direct type), the queue name needs to be passed, and the forwarder takes the queue name as a routing key and sends the message to the corresponding queue.
1. Create a sender Class
Package com.rabbit.test1;
Import Com.rabbitmq.client.Channel;
Import com.rabbitmq.client.Connection;
Import Com.rabbitmq.client.ConnectionFactory; /** * RABBITMQ Send Message * sender */public class Sender {//queue name private final static String queue_name = "Queue-t
EST "; public static void Main (string
Original link: http://haohaoxuexi.iteye.com/blog/1983532 Spring provides a jmstransactionmanager for transaction management of JMS ConnectionFactory. This will allow the JMS application to take advantage of Spring's transaction management features. Jmstransactionmanager binds a connectionfactory/session such as a pairing to a thread from the specified connectionfactory
defined in the JAVAX.JMS package. To use the JMS API, you need to create a connection factory that provides connection objects. The Connection object provides a link to the message server. A link is used to create a session that is used to create a message that is sent through the producer of the message to the target (queue or subject), and then the message is passed to the message consumer.
JMS Parent
PTP Domain
Pub/sub Domain
Document directory
3.1.sender.java
3.2.receiver.java
Activemq entry instance
1. Download activemq
Go to the official website download: http://activemq.apache.org/2. Run activemq
Uncompress apache-activemq-5.5.1-bin.zip, and double-click the apache-activemq-5.5.1 \ bin \ activemq. BAT to run the activemq program.
After activemq is started, log on to: http: // localhost: 8161/admin/and create a queue named firstqueue.3. Create and run an Eclipse project
Create a project: ActiveMQ-5.5 and impor
two categories: topic and queue. The individual interfaces defined for each destination type allow the vendor to support either type or both types, depending on the vendor's messaging tool. Topic is designed for publish/subscribe messaging, and the queue is designed for customer (point-to-point) message delivery. Both types of destination support persistence. JMS also provides support for transactions. Transactions enable you to support the submission and rollback of message delivery operations
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.