Package org.apache.activemq.pool

Examples of org.apache.activemq.pool.PooledConnectionFactory


  @Test
  public void testActiveMQOverriddenPoolAndRemoteServer() {
    load(TestConfiguration.class, "spring.activemq.pooled:true",
        "spring.activemq.brokerUrl:tcp://remote-host:10000");
    JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
    PooledConnectionFactory pool = this.context
        .getBean(PooledConnectionFactory.class);
    assertNotNull(jmsTemplate);
    assertNotNull(pool);
    assertEquals(jmsTemplate.getConnectionFactory(), pool);
    ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool
        .getConnectionFactory();
    assertEquals("tcp://remote-host:10000", factory.getBrokerURL());
  }
View Full Code Here


    public synchronized CamelContext getCamelContext() {
      if (camelContext == null) {
        LOG.debug("Creating camel context");
        camelContext = new DefaultCamelContext();
        ActiveMQConfiguration conf = new ActiveMQConfiguration();
        conf.setConnectionFactory(new PooledConnectionFactory((ActiveMQConnectionFactory)factory));
        ActiveMQComponent component = new ActiveMQComponent(conf);
        camelContext.addComponent("activemq", component);
      }
      return camelContext;
    }
View Full Code Here

   */
  public static JmsConnector createTestJmsConnector(String topicName) {
    ActiveMQConnectionFactory cf = createTestConnectionFactory();
    JmsConnectorFactoryBean factory = new JmsConnectorFactoryBean();
    factory.setName("ActiveMQTestUtils");
    factory.setConnectionFactory(new PooledConnectionFactory(cf));
    factory.setClientBrokerUri(BROKER_URI);
    factory.setTopicName(topicName);
    return factory.getObjectCreating();
  }
View Full Code Here

public class JmsBatchMessageDispatcherTest {

  @Test(invocationCount = 5, successPercentage = 19)
  public void queueOperation() throws InterruptedException {
    String queueName = "JmsBatchMessageDispatcherTest-queueOperation-" + System.getProperty("user.name") + "-" + System.currentTimeMillis();
    ConnectionFactory cf = new PooledConnectionFactory(ActiveMQTestUtils.createTestConnectionFactory());
   
    JmsTemplate sendingTemplate = new JmsTemplate();
    sendingTemplate.setConnectionFactory(cf);
    sendingTemplate.setPubSubDomain(false);
    sendingTemplate.setDefaultDestinationName(queueName);
View Full Code Here

    String destinationName = commandLine.getOptionValue(QUEUE_OPTION);
   
    ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(activeMQUrl);
    activeMQConnectionFactory.setWatchTopicAdvisories(false);
   
    PooledConnectionFactory jmsConnectionFactory = new PooledConnectionFactory(activeMQConnectionFactory);
    jmsConnectionFactory.start();
   
    JmsConnectorFactoryBean jmsConnectorFactoryBean = new com.opengamma.util.jms.JmsConnectorFactoryBean();
    jmsConnectorFactoryBean.setName("StandardJms");
    jmsConnectorFactoryBean.setConnectionFactory(jmsConnectionFactory);
    jmsConnectorFactoryBean.setClientBrokerUri(URI.create(activeMQUrl));
   
    JmsConnector jmsConnector = jmsConnectorFactoryBean.getObjectCreating();
    ByteArrayFudgeMessageReceiver fudgeReceiver = new ByteArrayFudgeMessageReceiver(new FudgeMessageReceiver() {
     
      @Override
      public void messageReceived(FudgeContext fudgeContext, FudgeMsgEnvelope msgEnvelope) {
        FudgeMsg message = msgEnvelope.getMessage();
        s_logger.debug("received {}", message);
      }
    }, s_fudgeContext);
    final JmsByteArrayMessageDispatcher jmsDispatcher = new JmsByteArrayMessageDispatcher(fudgeReceiver);
   
    Connection connection = jmsConnector.getConnectionFactory().createConnection();
    connection.start();
   
    pushTrade("ARG", connection, destinationName, jmsConnector, jmsDispatcher);
    Thread.sleep(WAIT_BTW_TRADES);
    pushTrade("MMM", connection, destinationName, jmsConnector, jmsDispatcher);
    Thread.sleep(WAIT_BTW_TRADES * 10);
    connection.stop();
    jmsConnectionFactory.stop();
  
  }
View Full Code Here

    connectionFactory.setWatchTopicAdvisories(false);
    return connectionFactory;
  }

  protected PooledConnectionFactory initPooledConnectionFactory() {
    return new PooledConnectionFactory(initActiveMQConnectionFactory());
  }
View Full Code Here

      LOGGER.info("Using brokerURI: " + brokerURI);
    }
   
    if (cf == null) {
      // need to be initialized
      cf = new PooledConnectionFactory(brokerURI);

    } else {
        if (changed) {
      // clear pending connections
      try {
        destroyConnectionFactory();
      } catch (Exception e) {
        // eat
      }
      // create a new connection
      cf = new PooledConnectionFactory(brokerURI);
      // cf.start();
        }

                }
    return cf;
View Full Code Here

    public static void startServers() throws Exception {
        Object implementor = new TestMtomJMSImpl();
        bus = BusFactory.getDefaultBus();

        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
        PooledConnectionFactory cfp = new PooledConnectionFactory(cf);
        cff = new ConnectionFactoryFeature(cfp);

        EndpointImpl ep = (EndpointImpl)Endpoint.create(implementor);
        ep.getFeatures().add(cff);
        ep.getInInterceptors().add(new TestMultipartMessageInterceptor());
View Full Code Here

    @BeforeClass
    public static void startServers() throws Exception {
        bus = BusFactory.getDefaultBus();
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
        PooledConnectionFactory cfp = new PooledConnectionFactory(cf);
        cff = new ConnectionFactoryFeature(cfp);
        String address = "http://localhost:" + PORT + "/SOAPDocLitService/SoapPort";
        Endpoint.publish(address, new HTTPGreeterImpl());
        EndpointImpl ep1 = (EndpointImpl)Endpoint.create(new JMSGreeterImpl());
        ep1.setBus(bus);
View Full Code Here

TOP

Related Classes of org.apache.activemq.pool.PooledConnectionFactory

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.