use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.
the class AsyncTopicProducerTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
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 TransactedTopicProducerTest method createCamelContext.
/*
* @see org.apache.camel.test.junit4.CamelTestSupport#createCamelContext()
* @return
* @throws Exception
*/
@Override
protected CamelContext createCamelContext() throws Exception {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useJmx=false");
ConnectionFactoryResource connectionResource = new ConnectionFactoryResource();
connectionResource.setConnectionFactory(connectionFactory);
connectionResource.setClientId("test-connection-1");
CamelContext camelContext = super.createCamelContext();
SjmsComponent component = new SjmsComponent();
component.setConnectionResource(connectionResource);
component.setConnectionCount(1);
camelContext.addComponent("sjms", component);
return camelContext;
}
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;
}
Aggregations