logic
The following shows the encoding template for JMS:
Send side:
Java code publicclassqueuesender{ publicstaticvoidmain (String[]args) throws jmsexception{ Connectionfactoryfactory=newactivemqconnectionfactory ("tcp://localhost:61616");//Here for simplicity, A JMS implementation that relies on ACTIVEMQ. In a real-world program, you can find factory through Jndi lookups, which completely avoids associating specific JMS implementations. a
The directory after ACTIVEMQ is extracted as follows:
Each directory is described as follows: Bin:activemq's startup script conf:activemq all profile data: Log file and persistent message DOCS:ACTIVEMQ official documentation EXAMPLES:ACTIVEMQ the official demo LIB:ACTIVEMQ Run the required library WEBAPPS:ACTIVEMQ Web console WEBAPPS-DEMO:ACTIVEMQ WebApps related demo ACTIVEMQ-ALL-5.13.2.JAR:ACTIVEMQ CLI ja
-3.3.6.tar.gz
and then unzip:
TAR-XVF zookeeper-3.3.6.tar.gz-c/opt/amqbroker (path to be unzipped)
Modify Profile:
zoo_sample.cfg Modify file name Zoo.cfg
Modify the Zoo.cfg configuration file content to
ticktime=2000
initlimit=10
synclimit=5
datadir=/opt/amqbroker/zookeeper/data
datalogdir=/opt/ Amqbroker/zookeeper/log
clientport=2181
server.one=192.168.0.100:2888:3888
server.two= 192.168.0.101:2888:3888
server.three=192.168.0.102:2888:3888
Then create the myID file in the/op
In the development process encountered a activemq deadlock problem, painful experience:
scenario: background processes (Appserver1) constantly generate tasks, send to queue front application (appservers) requests, get messages to the queue, and retrieve corresponding data according to the message.
question:
multithreading to the same queue directly call receive, receive messages, the queue will be locked:
The information on the server side dump is as
RabbitMQ, ACTIVEMQ, and ZEROMQ are excellent messaging middleware, but which of our options is better for our project? Many developers face this annoyance. Below I will make a comparison of the three message middleware, after you have seen it.RABBITMQ is a leading implementation of the AMQP protocol that implements the broker architecture, meaning that messages can be queued on the central node before they are sent to the client. This feature makes RA
Activemq startup is very simple.Such as1. Booting from a binary release packageOn Windows:CD [ACTIVEMQ_INSTALL_DIR]BIN\ACTIVEMQ Start2. Start from source mode650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/83/F7/wKioL1eCJReRNI5JAAA6BdItzjs378.png "title=" 111. PNG "alt=" Wkiol1ecjrerni5jaaa6bditzjs378.png "/>Main Class:org.apache.activemq.console.MainArguments:start Xbean:activemq2.xmlOne of the
Deployment configuration details for distributed ActiveMQ clusters:Official information: http://activemq.apache.org/clustering.htmlBasically look at this is enough, this article does not specifically analyze the configuration file.1.Queue consumer clusters:The same queue, if a consumer fails, the unacknowledged message is sent to the other queue's on the consumer. If a consumer processes messages faster, it will process more messages. The Queue cons
RabbitMQ, ACTIVEMQ, and ZEROMQ are excellent messaging middleware, but which of our options is better for our project? Many developers face this annoyance. Below I will make a comparison of the three message middleware, after you have seen it.RABBITMQ is a leading implementation of the AMQP protocol that implements the broker architecture, meaning that messages can be queued on the central node before they are sent to the client. This feature makes RA
ActiveMQ-cpp client application exited abnormallyThe author uses ActiveMQ as the server for message distribution in the system. The Java Web program reads the database real-time records as the Producer, and the receiving end is the client program developed by C ++ Builder. It is resident in the lower right corner of the client, the pop-up window displays real-time messages. During the test, it is found that
When activemq is used in Android projects, an error is reported.
The reason should be: the class you are about to use calls another class, and this class calls other classes. This relationship may have many layers. During this call, the missing package of a class will cause the above error.
Cannot be called. Http://www.blogjava.net/zJun/archive/2007/10/16/153374.html)
Read an article about how to use activemq
, you will cause a memory leak. This was discovered when I was testing it. Originally thought closed connection, the session generated by this connection will also be automatically closed, the result is not the case, the session did not close, resulting in memory leaks. So be sure to explicitly close the connection and session.
1.5 to the session to do object pool
Do object pooling for session, not connection. Session is also an expensive object, and each use is new and closed, at a very high pr
Security
ACTIVEMQ supports pluggable security mechanisms for switching between different provider. For example, JAAS authentication Plugin,custom authentication Implementation,authorization PluginThe following is an example of Jaas authentication plugin.
The Jaas authentication plugin relies on the standard JAAS mechanism to implement authentication. In general, you need to configure the login modules configuration file by setting the Java.security.au
Reprint please indicate the source: http://blog.csdn.net/l1028386804/article/details/75246853
ACTIVEMQ has support for both transactions, JMS transactions-the commit ()/rollback () methods on a session (which are like doing commit ()/Rollbac K () on a JDBC connection) XA Transactions-where The xasession acts as a XAResource by communicating and the message Br Oker, rather like a JDBC Connection takes place in an XA transaction through communicating w
The problems and solutions of the single machine affairs of Taobao's mass storage
http://blog.csdn.net/jiao_fuyou/article/details/15499261
This article is quite good. Core keywords: idempotent.
Message Queue Activemq:redeliver, how to do the retry mechanism does not result in a piece of information being executed multiple times. Http://stackoverflow.com/questions/4934386/avoiding-duplicated-messages-on-jms-activemq this inside mentioned two. One is
DeliveryMode refers to whether messages that were not consumed in the original queue or subject remain when the ACTIVEMQ is restarted
I have done the following tests myself through the code, and the test steps and results are as follows:
Create the producer and set the producer DeliveryMode to persistent and run producer
Restart ACTIVEMQ before the message is consumed by consumer
Tags: syslog technology share highlight RIP/USR boot start/etc OCA one1, under the root permission to operate2, Ln-s/USR/LOCAL/ACTIVEMQ/BIN/ACTIVEMQ/ETC/INIT.D/ACTIVEMQ3, VI/ETC/INIT.D/ACTIVEMQ4, add in the second line# # # # BEGIN INIT INFO # provides: activemq # required-start: $remote _fs $syslog # required-stop: $remote _fs $syslog
Technical Selection of message-oriented middleware-rabbitmq, activemq, and zeromq
Chszs, which must be noted for reprinting. Blog homepage: http://blog.csdn.net/chszs
Rabbitmq, activemq, and zeromq are both excellent message-oriented middleware. But which of the following is more suitable for our project? Many developers are faced with this problem. Below I will make a comparison between the three message-
Asynchronous process communication is an important component of the Service-Oriented Architecture (SOA), because many systems in an enterprise communicate, especially with external organizations, in essence, asynchronously. Java Message Service (JMS) is an API used to write Jee applications that use asynchronous message transmission. The traditional implementation of Message Passing using the jms api involves multiple steps, such as querying the queue connection factory and queue resources in JN
In Activemq's Conf/activemq.xml master config file, there is this passage,650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8B/6B/wKioL1hOO8GREhQQAAEBIUDtPqU599.png "title=" 1.png " alt= "Wkiol1hoo8grehqqaaebiudtpqu599.png"/>The Transportconnectors field in this figure is the MQ protocol port for each network, as shown by the figure, Openwire this name uses the access port is 61616,AMQP this name's access port number is 5672. The value of name is casually written, it will also be reflec
1. Use activemq through JNDI
1. Configure the JMS object in JNDI
java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory # use the following property to configure the default connectorjava.naming.provider.url = vm://localhost # use the following property to specify the JNDI name the connection factory# should appear as.#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry # register som
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.