use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.
the class SjmsBatchConsumerTest method createCamelContext.
@Override
public CamelContext createCamelContext() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
registry.put("testStrategy", new ListAggregationStrategy());
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(broker.getTcpConnectorUri());
SjmsComponent sjmsComponent = new SjmsComponent();
sjmsComponent.setConnectionFactory(connectionFactory);
SjmsBatchComponent sjmsBatchComponent = new SjmsBatchComponent();
sjmsBatchComponent.setConnectionFactory(connectionFactory);
CamelContext context = new DefaultCamelContext(registry);
context.addComponent("sjms", sjmsComponent);
context.addComponent("sjms-batch", sjmsBatchComponent);
return context;
}
use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.
the class AsyncConsumerFalseTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
camelContext.addComponent("async", new MyAsyncComponent());
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useJmx=false");
SjmsComponent component = new SjmsComponent();
component.setConnectionFactory(connectionFactory);
camelContext.addComponent("sjms", component);
return camelContext;
}
use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.
the class SjmsComponentAutoConfiguration method configureSjmsComponent.
@Lazy
@Bean(name = "sjms-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SjmsComponent.class)
public SjmsComponent configureSjmsComponent(CamelContext camelContext, SjmsComponentConfiguration configuration) throws Exception {
SjmsComponent component = new SjmsComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
if (paramClass.getName().endsWith("NestedConfiguration")) {
Class nestedClass = null;
try {
nestedClass = (Class) paramClass.getDeclaredField("CAMEL_NESTED_CLASS").get(null);
HashMap<String, Object> nestedParameters = new HashMap<>();
IntrospectionSupport.getProperties(value, nestedParameters, null, false);
Object nestedProperty = nestedClass.newInstance();
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), nestedProperty, nestedParameters);
entry.setValue(nestedProperty);
} catch (NoSuchFieldException e) {
}
}
}
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters);
return component;
}
use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.
the class JmsTestSupport method createCamelContext.
/*
* @see org.apache.camel.test.junit4.CamelTestSupport#createCamelContext()
* @return
* @throws Exception
*/
@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);
camelContext.addComponent("sjms", component);
return camelContext;
}
use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.
the class BatchTransactedProducerSupport method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(getBrokerUri());
SjmsComponent component = new SjmsComponent();
component.setConnectionFactory(connectionFactory);
camelContext.addComponent("sjms", component);
return camelContext;
}
Aggregations