Friday, April 17, 2009

AppEngine project on NetBeans

This is a beginning of discussion, continued here

Recently Google released an early look of AppEngine for Java. It includes an Eclipse plugin for developing with AppEngine Java SDK. I wanted to check is it possible to develop AppEngine Java application using NetBeans

Saturday, April 11, 2009

DelayQueue via interceptor

In the previous post I published a simple solution for using java.util.concurrent.DelayQueue with Spring Integration queue channel. Then Iwein Fuld suggested a nice improvement of namespace configuration. I liked the idea, but if the underlying queue is DelayQueue how to ensure all elements implement Delayed interface if I don't override doSend method and use the standard QueueChannel? That can be done with a ChannelInterceptor. I really like the way the guys from Spring Integration designed the API, there is an extension point just where you need it.

So if Iwein's proposition will be implemented, the configuration of the delay queue will look like this:


  
  
    
  



This also solves the problem with different delays for messages in the same queue. I made an example with HeaderDelayInterceptor, which looks at message header to set the time out.

DelayQueueChannel for Spring Integration

This is a beginning of discussion, continued here.

Spring Integration is an amazing project. It allows with a few lines of code or with a small Spring XML configuration to establish a powerful Enterprise Application Integration server. We are used to think about EAI as a heavy weight solution, but with Spring Integration it's a modest library deployed together with your console or web application. I'm really excited about its ease of use.

The central component in this framework is a message channel. It has a few implementations, most basic of which are direct channel and queue channel. Direct channel allows processing in the same thread, and queue channel holds messages until a processor will take them for processing.

When a message processing fails, it's usually desirable to wait before retrying. In EAI your application often depends on remote servers, which may be temporarily unavailable. If you try the failing operation in a few minutes, it has better chances to succeed.

Out of the box, Spring Integration does not provide a facility to delay messages for such a long period. While it's easy to insert a sleeping in the middle of processing, sleeping for long periods will waste precious thread resources of the server. So I extended Spring Integration queue channel to support delays.