Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQConnectionFactory


    public String sendTextMessage(Map headers, String body) throws Exception {

        String brokerUrl = "vm://" + broker.getBrokerName();
        ActiveMQDestination dest = destination.getActiveMQDestination();

        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(brokerUrl);
        Connection connection = null;
        try {

            connection = cf.createConnection();
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(dest);
            ActiveMQTextMessage msg = (ActiveMQTextMessage)session.createTextMessage(body);

            for (Iterator iter = headers.entrySet().iterator(); iter.hasNext();) {
View Full Code Here


     * BrokerService when the Connector is embedded
     *
     * @param service
     */
    public void setBrokerService(BrokerService service) {
        embeddedConnectionFactory = new ActiveMQConnectionFactory(service.getVmConnectorURI());
    }
View Full Code Here

        this.brokerUrl = brokerUrl;
    }

    public ConnectionFactory getConnectionFactory() {
        if (connectionFactory == null) {
            connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
        }
        return connectionFactory;
    }
View Full Code Here

    private int maximumActive = 500;
    private int maxConnections = 1;
    private TransactionManager transactionManager;

    public PooledConnectionFactory() {
        this(new ActiveMQConnectionFactory());
    }
View Full Code Here

    public PooledConnectionFactory() {
        this(new ActiveMQConnectionFactory());
    }

    public PooledConnectionFactory(String brokerURL) {
        this(new ActiveMQConnectionFactory(brokerURL));
    }
View Full Code Here

        JmsComponent jmsComponent = new JmsComponent();

        /**
         *
         */
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
        connectionFactory.setBrokerURL("failover://(tcp://localhost:61616)?maxReconnectAttempts=1");

        /**
         * When using Tibco EMS the problem can be recreated. As the broker is
         * external it has to be stopped and started by hand.
         */
 
View Full Code Here

    {
        useBytesMessage = new AtomicBoolean(baseConfig.getUseBytesMessage());

        final String uri = baseConfig.getUri();
        if (uri != null) {
            this.connectionFactory = new ActiveMQConnectionFactory(uri);
            this.connectionFactory.setUseAsyncSend(baseConfig.getUseAsyncSend());
        }
    }
View Full Code Here

   *            should be “tcp://{host}:{port}” or “vm://localhost” in case that the server is run inside the same virtual machine
   * @return the session object or “null” upon error
   */
  protected Session connectToServer(String server) {
    try {
      connection = new ActiveMQConnectionFactory(server).createConnection();
      connection.start();
      connection.setExceptionListener(this); // → ActiveMQDirector.onException()
      return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    } catch (Exception e) {
      logger.fatal("Error connecting to ActiveMQ server, giving up.", e);
View Full Code Here

    private void connect() throws JMSException
    {
        String url = String.format("%s://%s:%d", amqConfig.getProtocol(), amqConfig.getHost(), amqConfig.getPort());
        log.info("Connecting to: " + url);

        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(amqConfig.getUsername(), amqConfig.getPassword(), url);
        connection = connectionFactory.createConnection();
        connection.start();

        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        consumer = session.createConsumer(session.createTopic(amqConfig.getTopic()));
        consumer.setMessageListener(listener);
View Full Code Here

      Thread.sleep(1000);

      createCamelContext();

        ActiveMQConnectionFactory connFactory = new ActiveMQConnectionFactory(connector.getConnectUri());
        senderConnection = connFactory.createConnection();
        receiverConnection1 = connFactory.createConnection();
        receiverConnection2 = connFactory.createConnection();

        receiverConnection1.start();
        receiverConnection2.start();
    }
View Full Code Here

TOP

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