use of org.apache.camel.impl.StringDataFormat in project camel by apache.
the class HttpAsyncDslTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
// START SNIPPET: e1
// just a unit test but imaging using your own data format that does complex
// and CPU heavy processing for decrypting the message
DataFormat mySecureDataFormat = new StringDataFormat("iso-8859-1");
// list on the JMS queue for new orders
from("jms:queue:order").to("bean:validateOrder").to("mock:validate").threads(20).unmarshal(mySecureDataFormat).delay(500).to("bean:handleOrder").to("mock:order");
// END SNIPPET: e1
}
};
}
use of org.apache.camel.impl.StringDataFormat in project camel by apache.
the class StringDataFormatAutoConfiguration method configureStringDataFormatFactory.
@Bean(name = "string-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(StringDataFormat.class)
public DataFormatFactory configureStringDataFormatFactory(final CamelContext camelContext, final StringDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
StringDataFormat dataformat = new StringDataFormat();
if (CamelContextAware.class.isAssignableFrom(StringDataFormat.class)) {
CamelContextAware contextAware = CamelContextAware.class.cast(dataformat);
if (contextAware != null) {
contextAware.setCamelContext(camelContext);
}
}
try {
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
return dataformat;
}
};
}
Aggregations