Posts

Showing posts with the label Camel

JEE Concurrent with Camel

The official specs for JEE servers, say that your not meant to start your own threads, implying an impending doom if you do so. In actually you loose some functionality in terms of what the app server provides/allows and the app server isn't easily able to kill off rogue threads when you try and undeploy. Not the worst things in the world but if we could do something about it we would. The first 'standard' support for spawning threads in a container was the commonj Work Manager and Timer . It was a bit clunky to use, hard to integrate and not supported across the board. Thankfully they made the smart decision to just extend Doug Lea's framework in concurrency-ee . Integrating this into camel but substituting the used ThreadFactory with the container provided ManagedThreadFactory. The one downside of doing this is that we loose don't create the threads so we may not be able to set the name. Having said that, using a nifty trick I was able to set it on Websphere Lib...

Using SQL Server as an imitation Queue with Camel

SQL Server's lock hints allow to you to use it as a database queue. The general process is discussed on stackoverflow . Here I wanted to summarise the different ways it can be configured with the camel-jpa component. Testing was done against SQL Server 2008 R2 Developer Edition. The list of locks was obtained using this useful script from Microsoft . Assume we have a generic entity: @Entity public class JpaMessage { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; /** an optional hint as to type of message */ private String msgType; /** a refrence to another table containing the blob for performance reasons */ private Long msgBlobId; /** to allow for PESSIMISTIC locking */ @Version private Date lastUpdated; } /** basic route */ public class TestRoutbuiler extends BaseRouteBuilder { @Value("${endpoint.uri}") private String endpointUri; @Override public void configure() throws Exception { ...

Setting ApplIdentityData on a Liberty Profile defined queue

Setting the necessary properties on the Java Client for MQ libraries in order to pass the ApplIdentityData is quiet simple, as mentioned in this stackoverflow post : MQDestination queue; //... queue.setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true); queue.setBooleanProperty(WMQConstants.WMQ_MQMD_READ_ENABLED, true); queue.setIntProperty(WMQConstants.WMQ_MQMD_MESSAGE_CONTEXT, WMQConstants.WMQ_MDCTX_SET_ALL_CONTEXT); javax.jms.Message message; //... message.setStringProperty(JmsConstants.JMS_IBM_MQMD_APPLIDENTITYDATA, "...."); The meaning of the properties is listed in the documentation: Destination object properties . If using Websphere Application Server, you can define a Jms Queue as a Resource which can be intern looked up via JNDI. IBM has a pretty good summary of the different methods. How to read and write fields from the MQMD via WebSphere MQ Classes for JMS Version 7: direct, using JNDI and using WebSphere Application Server . To set it up in WAS7 f...