How to Send a Message to a JBoss A-MQ Network of Brokers

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;

import org.apache.activemq.ActiveMQConnectionFactory;

public final class AMQSample {

  public static void main(final String[] args) throws Exception {
    final ConnectionFactory connFactory = new ActiveMQConnectionFactory("failover:(tcp://host1:61616,tcp://host2:61616)"); // for the failover transport

    final Connection conn = connFactory.createConnection("username", "password");

    final Session sess = ...

    final Destination dest = ...

    final MessageProducer prod = sess.createProducer(dest);

    final Message msg = ...




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.