Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQConnectionFactory.createConnection()


    // Connection connection = null;
    ActiveMQConnection connection = null;
    try {
      // Create the connection.
      ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
      connection = (ActiveMQConnection) connectionFactory.createConnection();
      connection.start();
      // Create the session
      Session session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
      if (topic) {
        destination = session.createTopic(subject);
View Full Code Here


  public void run() {
    try {
      running = true;
      ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
      connection = (ActiveMQConnection) connectionFactory.createConnection();
      if (durable && clientId != null && clientId.length() > 0 && !"null".equals(clientId)) {
        connection.setClientID(clientId);
      }
//      connection.setExceptionListener(this);
      connection.start();
View Full Code Here

    public void run() {
        try {
            running = true;

            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
            Connection connection = connectionFactory.createConnection();
            if (durable && clientId != null && clientId.length() > 0 && !"null".equals(clientId)) {
                connection.setClientID(clientId);
            }
            connection.setExceptionListener(this);
            connection.start();
View Full Code Here

//        Connection connection = null;
      ActiveMQConnection  connection = null;
        try {
            // Create the connection.
            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
            connection = (ActiveMQConnection) connectionFactory.createConnection();
            connection.start();

            // Create the session
            Session session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
            if (topic) {
View Full Code Here

  }

  private static void go(String brokerUrl, String topicName) throws JMSException {
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
    connectionFactory.setBrokerURL(brokerUrl);
    Connection connection = connectionFactory.createConnection();
    ActiveMQTopic topic = new ActiveMQTopic(topicName);
    MessageConsumer consumer = connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(topic);
    connection.start();
    while(true) {
      Message m = consumer.receive();
View Full Code Here

  }

  private void putQueue(List<String> events) throws Exception {
    ConnectionFactory factory = new ActiveMQConnectionFactory(USERNAME,
        PASSWORD, BROKER_BIND_URL);
    Connection connection = factory.createConnection();
    connection.start();

    Session session = connection.createSession(true,
        Session.AUTO_ACKNOWLEDGE);
    Destination destination = session.createQueue(DESTINATION_NAME);
View Full Code Here

  }

  private void putTopic(List<String> events) throws Exception {
    ConnectionFactory factory = new ActiveMQConnectionFactory(USERNAME,
        PASSWORD, BROKER_BIND_URL);
    Connection connection = factory.createConnection();
    connection.start();

    Session session = connection.createSession(true,
        Session.AUTO_ACKNOWLEDGE);
    Destination destination = session.createTopic(DESTINATION_NAME);
View Full Code Here

    private static final String TEST_QUEUE_NAME = "test";
   
    private Connection createAndStartConnection() throws JMSException {
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://test?broker.persistent=false");
        Connection con = cf.createConnection();
        con.start();
        return con;
    }

    @Test
View Full Code Here

     */
    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUri);
        connection = connectionFactory.createConnection();
        connection.start();
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        SjmsComponent component = new SjmsComponent();
        component.setConnectionCount(1);
        component.setConnectionFactory(connectionFactory);
View Full Code Here

    } catch(Exception e) {
      System.err.println("Cannot broker messages: " + e);
    }
    ActiveMQConnectionFactory connectionFactory=new ActiveMQConnectionFactory("vm://localhost");

    Connection connection=connectionFactory.createConnection();
    connection.start();
    Session session=connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

    Destination destination=session.createQueue("noit.firehose");
    consumer = session.createConsumer(destination);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.