org.apache.activemq.camel.component.ActiveMQComponent Java Examples

The following examples show how to use org.apache.activemq.camel.component.ActiveMQComponent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RouteIT.java    From fcrepo-camel-toolbox with Apache License 2.0 6 votes vote down vote up
@Override
protected void addServicesOnStartup(final Map<String, KeyValueHolder<Object, Dictionary>> services) {
    final String jmsPort = System.getProperty("fcrepo.dynamic.jms.port", "61616");
    final String webPort = System.getProperty("fcrepo.dynamic.test.port", "8080");
    final ActiveMQComponent component = new ActiveMQComponent();

    component.setBrokerURL("tcp://localhost:" + jmsPort);
    component.setExposeAllQueues(true);

    final FcrepoComponent fcrepo = new FcrepoComponent();
    fcrepo.setBaseUrl("http://localhost:" + webPort + "/fcrepo/rest");
    fcrepo.setAuthUsername(FEDORA_USERNAME);
    fcrepo.setAuthPassword(FEDORA_PASSWORD);
    services.put("broker", asService(component, "osgi.jndi.service.name", "fcrepo/Broker"));
    services.put("fcrepo", asService(fcrepo, "osgi.jndi.service.name", "fcrepo/Camel"));
}
 
Example #2
Source File: JmsTransactionTest.java    From camel-cookbook-examples with Apache License 2.0 6 votes vote down vote up
@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    ActiveMQConnectionFactory connectionFactory =
        new ActiveMQConnectionFactory();
    connectionFactory.setBrokerURL(broker.getTcpConnectorUri());
    registry.put("connectionFactory", connectionFactory);

    JmsTransactionManager jmsTransactionManager = new JmsTransactionManager();
    jmsTransactionManager.setConnectionFactory(connectionFactory);
    registry.put("jmsTransactionManager", jmsTransactionManager);

    SpringTransactionPolicy policy = new SpringTransactionPolicy();
    policy.setTransactionManager(jmsTransactionManager);
    policy.setPropagationBehaviorName("PROPAGATION_REQUIRED");
    registry.put("PROPAGATION_REQUIRED", policy);

    CamelContext camelContext = new DefaultCamelContext(registry);

    ActiveMQComponent activeMQComponent = new ActiveMQComponent();
    activeMQComponent.setConnectionFactory(connectionFactory);
    activeMQComponent.setTransactionManager(jmsTransactionManager);
    camelContext.addComponent("jms", activeMQComponent);

    return camelContext;
}
 
Example #3
Source File: RouteIT.java    From fcrepo-camel-toolbox with Apache License 2.0 5 votes vote down vote up
@Override
protected void addServicesOnStartup(final Map<String, KeyValueHolder<Object, Dictionary>> services) {
    final String jmsPort = System.getProperty("fcrepo.dynamic.jms.port", "61616");
    final String webPort = System.getProperty("fcrepo.dynamic.test.port", "8080");
    final ActiveMQComponent amq = new ActiveMQComponent();

    amq.setBrokerURL("tcp://localhost:" + jmsPort);
    amq.setExposeAllQueues(true);
    final FcrepoComponent fcrepo = new FcrepoComponent();
    fcrepo.setBaseUrl("http://localhost:" + webPort + "/fcrepo/rest");
    fcrepo.setAuthUsername(FEDORA_AUTH_USERNAME);
    fcrepo.setAuthPassword(FEDORA_AUTH_PASSWORD);
    services.put("broker", asService(amq, "osgi.jndi.service.name", "fcrepo/Broker"));
    services.put("fcrepo", asService(fcrepo, "osgi.jndi.service.name", "fcrepo/Camel"));
}
 
Example #4
Source File: RouteIT.java    From fcrepo-camel-toolbox with Apache License 2.0 5 votes vote down vote up
@Override
protected void addServicesOnStartup(final Map<String, KeyValueHolder<Object, Dictionary>> services) {
    final String jmsPort = System.getProperty("fcrepo.dynamic.jms.port", "61616");
    final ActiveMQComponent component = new ActiveMQComponent();

    component.setBrokerURL("tcp://localhost:" + jmsPort);
    component.setExposeAllQueues(true);

    services.put("broker", asService(component, "osgi.jndi.service.name", "fcrepo/Broker"));
}
 
Example #5
Source File: InventoryRoute.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
/**
 * Setup JMS component
 */
@Produces
@Named("jms")
public static JmsComponent jmsComponent() {
    ActiveMQComponent jms = new ActiveMQComponent();
    jms.setBrokerURL("tcp://localhost:61616");
    return jms;
}
 
Example #6
Source File: InventoryRoute.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
/**
 * Setup JMS component
 */
@Produces
@Named("jms")
public static JmsComponent jmsComponent() {
    ActiveMQComponent jms = new ActiveMQComponent();
    jms.setBrokerURL("tcp://localhost:61616");
    return jms;
}
 
Example #7
Source File: JmsTransactionRequestReplyTest.java    From camel-cookbook-examples with Apache License 2.0 5 votes vote down vote up
@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    ActiveMQConnectionFactory connectionFactory =
        new ActiveMQConnectionFactory("vm://embedded?broker.persistent=false");
    registry.put("connectionFactory", connectionFactory);

    JmsTransactionManager jmsTransactionManager = new JmsTransactionManager();
    jmsTransactionManager.setConnectionFactory(connectionFactory);
    registry.put("jmsTransactionManager", jmsTransactionManager);

    SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy();
    propagationRequired.setTransactionManager(jmsTransactionManager);
    propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED");
    registry.put("PROPAGATION_REQUIRED", propagationRequired);

    SpringTransactionPolicy propagationNotSupported = new SpringTransactionPolicy();
    propagationNotSupported.setTransactionManager(jmsTransactionManager);
    propagationNotSupported.setPropagationBehaviorName("PROPAGATION_NOT_SUPPORTED");
    registry.put("PROPAGATION_NOT_SUPPORTED", propagationNotSupported);

    CamelContext camelContext = new DefaultCamelContext(registry);

    ActiveMQComponent activeMQComponent = new ActiveMQComponent();
    activeMQComponent.setConnectionFactory(connectionFactory);
    activeMQComponent.setTransactionManager(jmsTransactionManager);
    camelContext.addComponent("jms", activeMQComponent);

    return camelContext;
}
 
Example #8
Source File: JmsTransactionEndpointTest.java    From camel-cookbook-examples with Apache License 2.0 5 votes vote down vote up
@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();

    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
    connectionFactory.setBrokerURL(broker.getTcpConnectorUri());
    registry.put("connectionFactory", connectionFactory);

    CamelContext camelContext = new DefaultCamelContext(registry);
    ActiveMQComponent activeMQComponent = new ActiveMQComponent();
    activeMQComponent.setConnectionFactory(connectionFactory);
    camelContext.addComponent("jms", activeMQComponent);
    return camelContext;
}
 
Example #9
Source File: K8ActiveMQConfiguration.java    From funktion-connectors with Apache License 2.0 4 votes vote down vote up
protected void setActiveMQComponent(ActiveMQComponent activeMQComponent) {
    super.setActiveMQComponent(activeMQComponent);
}
 
Example #10
Source File: JMSAppenderTest.java    From servicemix with Apache License 2.0 4 votes vote down vote up
@Override
protected Context createJndiContext() throws Exception {
    Context context = super.createJndiContext();
    context.bind("amq", ActiveMQComponent.activeMQComponent(broker.getVmConnectorURI().toString() + "?create=false"));
    return context;
}