Package org.activemq

Examples of org.activemq.ActiveMQConnectionFactory


 
    /**
     * Factory method to create a new connection factory from the given environment
     */
    protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) {
        ActiveMQConnectionFactory answer = new ActiveMQConnectionFactory();
        Properties properties = new Properties();
        properties.putAll(environment);
        answer.setProperties(properties);
        return answer;
    }
View Full Code Here


        this(connector.threadPool);
        this.brokerContainer = brokerContainer;
        this.uri = "";
        this.remoteBrokerName = remoteBrokerName;
        this.remoteClusterName = remoteclusterName;
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory();
        fac.setJ2EEcompliant(false);
        fac.setTurboBoost(true);
        remoteConnection = new ActiveMQConnection(fac, remoteUserName, remotePassword, channel);
        remoteConnection.setClientID("Boondocks:" + remoteClusterName + ":" + remoteBrokerName);
        remoteConnection.setQuickClose(true);
        remoteConnection.start();
        BrokerInfo info = new BrokerInfo();
View Full Code Here

     * @return Connection - broker connection.
     */
    private static Connection createConnectionFactory(String url,
                                                     boolean embeddedBroker) throws JMSException {
        //Used to create a session from the default MQ server ActiveMQConnectionFactory.
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url);

        if (embeddedBroker) {
            factory.setUseEmbeddedBroker(true);
        }

        factory.setTurboBoost(true);
        ActiveMQConnection c = (ActiveMQConnection) factory.createConnection();

        c.getPrefetchPolicy().setQueuePrefetch(1000);
        c.getPrefetchPolicy().setQueueBrowserPrefetch(1000);
        c.getPrefetchPolicy().setTopicPrefetch(1000);
        c.getPrefetchPolicy().setDurableTopicPrefetch(1000);
View Full Code Here

*/
public class MessageSenderAMQ {

  public static void main(String[] args) throws Exception {

    ActiveMQConnectionFactory connectionFactory =
      new ActiveMQConnectionFactory("tcp://localhost:61616");
   
    QueueConnection connection = (QueueConnection)connectionFactory.createConnection();   
   
    try {
      Session session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
      Queue queue = session.createQueue("SendReceiveQueue");   
      MessageProducer sender = session.createProducer(queue);
View Full Code Here

    private Destination destination;
    private String destinationName = "foo.bar";
    private WaitableBoolean inDemand = new WaitableBoolean(false);
       
    protected void setUp() throws Exception{
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("vm://localhost");
        connection = fac.createConnection();
        session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
        destination = session.createTopic(destinationName);
        connection.start();
    }
View Full Code Here

    private int messageMultiplier = 1;

    public Server() throws JMSException {
        super();

        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
        connectionFactory.setUseEmbeddedBroker(true);
        connectionFactory.setBrokerURL("vm://localhost");
        connectionFactory.setBrokerXmlConfig("file:" + configFile);

        cf = connectionFactory;

        initQueue();
        initListener();
View Full Code Here

        assertConnectionFactoryPresent("jms/DURABLE_SUB_CONNECTION_FACTORY");
    }
   
    public void testConnectionFactoriesAreConfigured() throws NamingException {
        super.testConnectionFactoriesArePresent();
        ActiveMQConnectionFactory factory1 = (ActiveMQConnectionFactory) context.lookup("jms/Connection");
        assertNull(factory1.getClientID());
        ActiveMQConnectionFactory factory2 = (ActiveMQConnectionFactory) context.lookup("jms/DURABLE_SUB_CONNECTION_FACTORY");
        assertEquals("testclient", factory2.getClientID());
    }
View Full Code Here

       
        String[] names = getConnectionFactoryNames(environment);
        for (int i = 0; i < names.length; i++) {
           
            String name = names[i];
            ActiveMQConnectionFactory factory = createConnectionFactory(name, environment);
           
            if( broker==null ) {
                try {
                    broker = factory.getEmbeddedBroker();
                }
                catch (JMSException ignore) {
                }
            }
            data.put(name,factory);
View Full Code Here

 
    /**
     * Factory method to create a new connection factory from the given environment
     */
    protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) {
        ActiveMQConnectionFactory answer = new ActiveMQConnectionFactory();
        Properties properties = new Properties();
        properties.putAll(environment);
        answer.setProperties(properties);
        return answer;
    }
View Full Code Here

        this(connector.threadPool);
        this.brokerContainer = brokerContainer;
        this.uri = "";
        this.remoteBrokerName = remoteBrokerName;
        this.remoteClusterName = remoteclusterName;
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory();
        fac.setJ2EEcompliant(false);
        fac.setTurboBoost(true);
        remoteConnection = new ActiveMQConnection(fac, remoteUserName, remotePassword, channel);
        remoteConnection.setClientID("Boondocks:" + remoteClusterName + ":" +  remoteBrokerName);
        remoteConnection.setQuickClose(true);
        remoteConnection.start();
        BrokerInfo info = new BrokerInfo();
View Full Code Here

TOP

Related Classes of org.activemq.ActiveMQConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.