Documente Academic
Documente Profesional
Documente Cultură
JMS
Prerequisites: I have used the following
software and tools
Java programming Language
Eclipse IDE
Apache ActiveMQ message broker 5.4.3 version
JDK 1.7
JRE 1.8
ActiveMQ
is an open-source, messaging software which
Apache ActiveMQ.
Download apache-activemq-5.4.3 from
http://activemq.apache.org/activemq-543-release
.html
depending on the operating system. Just extract
the compressed file move to apache-activemq5.4.3\bin\ win32 folder and start the server
using activemq.bat or activemq.sh file.
The server should start without any issue. To test
whether the server is running or not, browse
http://localhost:8161.
! Warning message to set environmental variable
for java may be asked
http://localhost:8161/admin/
If it is asking for user name and password
(recent versions are secured with password),
provide admin as username and password.
8)A page looks like the one shown below will
be opened.
package com.mindfire.jms;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.QueueSender;
import javax.jms.DeliveryMode;
import javax.jms.QueueSession;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
public class Sender {
public static void main(String[] args) throws
Exception {
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFa
ctory");
env.put(Context.PROVIDER_URL,
"tcp://localhost:61616");
package com.mindfire.jms;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import
import
import
import
import
import
import
javax.jms.Queue;
javax.jms.Session;
javax.jms.TextMessage;
javax.jms.QueueSession;
javax.jms.QueueReceiver;
javax.jms.QueueConnection;
javax.jms.QueueConnectionFactory;