Package org.codehaus.activemq

Examples of org.codehaus.activemq.ActiveMQConnectionFactory


        pwd = getConfiguration().getString(CONFIG_PWD, DEFAULT_PWD);
    }
       
    protected void createConnection() throws JMSException {
        String providerURL = getProviderURL();
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, pwd, providerURL);
        connection = connectionFactory.createConnection();
    }
View Full Code Here


    private String topicPrefix = "topic.";

    public Context getInitialContext(Hashtable environment) throws NamingException {
        // lets create a factory
        Map data = new ConcurrentHashMap();
        ActiveMQConnectionFactory factory = createConnectionFactory(environment);

        String[] names = getConnectionFactoryNames(environment);
        for (int i = 0; i < names.length; i++) {
            String name = names[i];
            data.put(name, factory);
        }
       
        // Bind jms/DURABLE_SUB_CONNECTION_FACTORY to be a ConnectionFactory that can be used for durable subscriptions.
        ActiveMQConnectionFactory durableFactory = createDurableConnectionFactory(environment);
        Map jmsContext = new ConcurrentHashMap();
        jmsContext.put("DURABLE_SUB_CONNECTION_FACTORY", durableFactory);
        data.put("jms", new ReadOnlyContext(environment, jmsContext));

        createQueues(data, environment);
View Full Code Here

            }
        }
    }

    protected ActiveMQConnectionFactory createDurableConnectionFactory(Hashtable environment) {
        ActiveMQConnectionFactory answer = createConnectionFactory(environment);
        if (answer.getClientID() == null || answer.getClientID().length() == 0) {
            answer.setClientID("clientid");
        }
        return answer;
    }
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

 
  /**
   * @see org.codehaus.activemq.JmsResourceProvider#createConnectionFactory()
   */
  public ConnectionFactory createConnectionFactory() throws JMSException {
    return new ActiveMQConnectionFactory(serverUri);
  }
View Full Code Here

    public NetworkChannel(NetworkConnector connector, BrokerContainer brokerContainer, TransportChannel channel)
            throws JMSException {
        this(connector.threadPool);
        this.brokerContainer = brokerContainer;
        this.uri = "";
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory();
        fac.setUseAsyncSend(true);
        remoteConnection = new ActiveMQConnection(fac, remoteUserName, remotePassword, channel);
        remoteConnection.setUseAsyncSend(true);
    }
View Full Code Here

        initializeLocal();
    }

    private void initializeRemote() throws JMSException {
        if (remoteConnection == null) {
            ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(remoteUserName, remotePassword, uri);
            factory.setUseAsyncSend(true);
            remoteConnection = (ActiveMQConnection) factory.createConnection();
        }
        initializeRemoteConnection(remoteConnection);
    }
View Full Code Here

        }
    }

    private void initializeLocal() throws JMSException {
        String brokerName = brokerContainer.getBroker().getBrokerName();
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://" + brokerName);
        factory.setUseAsyncSend(true);
        factory.setBrokerName(brokerName);
        localConnection = (ActiveMQConnection) factory.createConnection();
        localConnection.setJ2EEcompliant(false);
        localConnection.start();
        BrokerInfo info = new BrokerInfo();
        info.setBrokerName(remoteBrokerName);
        info.setClusterName(remoteClusterName);
View Full Code Here

    private String topicPrefix = "topic.";

    public Context getInitialContext(Hashtable environment) throws NamingException {
        // lets create a factory
        Map data = new ConcurrentHashMap();
        ActiveMQConnectionFactory factory = createConnectionFactory(environment);
        data.put("ConnectionFactory", factory);
        data.put("QueueConnectionFactory", factory);
        data.put("TopicConnectionFactory", factory);

        createQueues(data, environment);
        createTopics(data, environment);

        try {
            Broker broker = factory.getEmbeddedBroker();
            if (broker != null) {
                data.put("destinations", broker.getDestinationContext(environment));
            }
        }
        catch (JMSException e) {
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

TOP

Related Classes of org.codehaus.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.