当前位置: 首页>>代码示例>>Java>>正文


Java ActiveMQComponent类代码示例

本文整理汇总了Java中org.apache.activemq.camel.component.ActiveMQComponent的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQComponent类的具体用法?Java ActiveMQComponent怎么用?Java ActiveMQComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ActiveMQComponent类属于org.apache.activemq.camel.component包,在下文中一共展示了ActiveMQComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCamelContext

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@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;
}
 
开发者ID:CamelCookbook,项目名称:camel-cookbook-examples,代码行数:31,代码来源:JmsTransactionRequestReplyTest.java

示例2: activeMQComponent

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@Bean(name="activemq")
	ActiveMQComponent activeMQComponent(){
		// 修改为activemq component ,activemq做了调优
		ActiveMQConfiguration config = new ActiveMQConfiguration();
//		config.setMapJmsMessage(false); // 自动映射jms消息
		config.setConcurrentConsumers(jmsMinConsumers);
		config.setMaxConcurrentConsumers(jmsMaxConsumers);
		config.setConnectionFactory(connectionFactory());
//		config.setAcknowledgementMode(cc);
//		config.setAcknowledgementMode(Session.CLIENT_ACKNOWLEDGE);
		config.setAcknowledgementMode(Session.SESSION_TRANSACTED);
		// 事务控制
//		config.setTransactionManager(transactionManger());
		config.setTransacted(true);
		ActiveMQComponent component = new ActiveMQComponent(config);
		component.setMessageConverter(new EventMessageConvertor());
		// session 客户端确认/无事务
//				component.setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE); 
//				component.setAcknowledgementMode(Session.CLIENT_ACKNOWLEDGE); 
		// 针对本地事务(非XA事务的调优)
		component.setCacheLevelName("CACHE_CONSUMER");
		return component;
	}
 
开发者ID:eXcellme,项目名称:eds,代码行数:24,代码来源:EdsCamelConfig.java

示例3: createActiveMQComponent

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
/**
 * Factory to create the {@link ActiveMQComponent} which is used in this application
 * to connect to the remote ActiveMQ broker.
 */
@Produces
public static ActiveMQComponent createActiveMQComponent() {
    // you can set other options but this is the basic just needed

    ActiveMQComponent amq = new ActiveMQComponent();

    // The ActiveMQ Broker allows anonymous connection by default
    // amq.setUserName("admin");
    // amq.setPassword("admin");

    // the url to the remote ActiveMQ broker
    amq.setBrokerURL("tcp://localhost:61616");

    return amq;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:WidgetApplication.java

示例4: configure

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@Override
public void configure() throws Exception {
    JaxbDataFormat jaxb = new JaxbDataFormat();
    jaxb.setContextPath("camelinaction");

    // TODO: due activemq bug we need to configure it here also
    ActiveMQComponent jms = new ActiveMQComponent(getContext());
    jms.setBrokerURL("tcp://localhost:61616");
    getContext().addComponent("jms", jms);

    from("direct:inventory")
        .log("Calling inventory service using JMS")
        .hystrix()
            // call the legacy system using JMS
            .to("jms:queue:inventory")
            // the returned data is in XML format so convert that to POJO using JAXB
            .unmarshal(jaxb)
        .onFallback()
            .log("Circuit breaker failed so using fallback response")
            // fallback and read inventory from classpath which is in XML format
            .transform().constant("resource:classpath:fallback-inventory.xml");
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:23,代码来源:InventoryRoute.java

示例5: newAMQInstance

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
public static ActiveMQComponent newAMQInstance(){
	 ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
	    connectionFactory.setBrokerURL("vm:localhost");
	    // use a pooled connection factory between the module and the queue
	    PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory(connectionFactory);

	    // how many connections should there be in the session pool?
	    pooledConnectionFactory.setMaxConnections(100);
	    pooledConnectionFactory.setMaximumActiveSessionPerConnection(100);
	    pooledConnectionFactory.setCreateConnectionOnStartup(true);
	    pooledConnectionFactory.setBlockIfSessionPoolIsFull(false);

	    JmsConfiguration jmsConfiguration = new JmsConfiguration(pooledConnectionFactory);
	    jmsConfiguration.setDeliveryPersistent(false);
	    jmsConfiguration.setTimeToLive(1000*10);
	    ActiveMQComponent activeMQComponent = ActiveMQComponent.activeMQComponent("vm:localhost");
	    return activeMQComponent;
}
 
开发者ID:SignalK,项目名称:signalk-server-java,代码行数:19,代码来源:ActiveMqBrokerFactory.java

示例6: createCamelContext

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@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;
}
 
开发者ID:CamelCookbook,项目名称:camel-cookbook-examples,代码行数:27,代码来源:JmsTransactionTest.java

示例7: createActiveMQComponent

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@Produces
@Named("activemq")
public ActiveMQComponent createActiveMQComponent() {
    ActiveMQComponent activeMQComponent = ActiveMQComponent.activeMQComponent();
    activeMQComponent.setConnectionFactory(connectionFactory);
    return activeMQComponent;
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel-examples,代码行数:8,代码来源:ActiveMQComponentProducer.java

示例8: createActiveMQComponent

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
public static ActiveMQComponent createActiveMQComponent() {
    // you can set other options but this is the basic just needed

    ActiveMQComponent amq = new ActiveMQComponent();

    // The ActiveMQ Broker allows anonymous connection by default
    // amq.setUserName("admin");
    // amq.setPassword("admin");

    // the url to the remote ActiveMQ broker
    amq.setBrokerURL("tcp://localhost:61616");

    return amq;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:WidgetMain.java

示例9: createCamelContext

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ActiveMQComponent activemq =
        activeMQComponent("vm://localhost?broker.persistent=false&broker.useJmx=false&jms.redeliveryPolicy.maximumRedeliveries=0" 
                          + "&jms.redeliveryPolicy.initialRedeliveryDelay=500&jms.useAsyncSend=false&jms.sendTimeout=10000"
                          + "&jms.maxReconnectAttempts=1&jms.timeout=3000");
    camelContext.addComponent("activemq", activemq);
    return camelContext;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:JmsHammerTest.java

示例10: addServicesOnStartup

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@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");

    services.put("broker", asService(component, "osgi.jndi.service.name", "fcrepo/Broker"));
    services.put("fcrepo", asService(fcrepo, "osgi.jndi.service.name", "fcrepo/Camel"));
}
 
开发者ID:fcrepo4-exts,项目名称:fcrepo-camel-toolbox,代码行数:16,代码来源:RouteIT.java

示例11: addServicesOnStartup

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@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");

    services.put("broker", asService(amq, "osgi.jndi.service.name", "fcrepo/Broker"));
    services.put("fcrepo", asService(fcrepo, "osgi.jndi.service.name", "fcrepo/Camel"));
}
 
开发者ID:fcrepo4-exts,项目名称:fcrepo-camel-toolbox,代码行数:16,代码来源:RouteIT.java

示例12: addServicesOnStartup

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@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"));
}
 
开发者ID:fcrepo4-exts,项目名称:fcrepo-camel-toolbox,代码行数:11,代码来源:RouteIT.java

示例13: jmsComponent

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
/**
 * Setup JMS component
 */
@Produces
@Named("jms")
public static JmsComponent jmsComponent() {
    ActiveMQComponent jms = new ActiveMQComponent();
    jms.setBrokerURL("tcp://localhost:61616");
    return jms;
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:11,代码来源:InventoryRoute.java

示例14: activeMq

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@Bean(name = "activeMq")
public ActiveMQComponent activeMq() {
    ActiveMQComponent activeMQComponent = new ActiveMQComponent();
    activeMQComponent.setUseMessageIDAsCorrelationID(true);
    activeMQComponent.setConnectionFactory(activeMqConnectionFactory());
    return activeMQComponent;
}
 
开发者ID:przodownikR1,项目名称:cxf_over_jms_kata,代码行数:8,代码来源:SimpleActiveMqConfig.java

示例15: createCamelContext

import org.apache.activemq.camel.component.ActiveMQComponent; //导入依赖的package包/类
@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;
}
 
开发者ID:CamelCookbook,项目名称:camel-cookbook-examples,代码行数:15,代码来源:JmsTransactionEndpointTest.java


注:本文中的org.apache.activemq.camel.component.ActiveMQComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。