These are the observations that I ran into when I tried to implement the functionalities of the thread "Spring Integration for ESB"
Please read on
Following was noticed with SI-M4
I did the following to create customized channels:
They are very simple (No error handling etc).
It just writes the incoming messages into a folder in a predetermined directory, upon a doSend() method.
It just reads the files (to get messages) from the folder in a predetermined directory, upon a doReceive() method.
Implemented the purge() and clear methods() of the super interface.
Please see the code in the package com/example for CustomChannel.java and CustomChannelFactory.java
I wanted to use my above CustomChannel in the 'quote' demo, so I did the following:
As per the reference documentation, I did the following changes to the configuration file
Issue no. 1:
<message-bus channel-factory="customChannelFactory" />
<beans:bean id="customChannelFactory" class="com.example.CustomChannelFactory" />
I made the Quote class Serializable.
According to the documentation this should create and register the custom channels but it didnt.
The message bus still created and registered SimpleQueueChannel.
However,I unregistered the SimpleQueueChannel and created a new CustomChannel and registered it with
the same name("quotes") this made the Publisher publish messages into the CustomChannel (I could
see the files being created in the folder) and the Subscriber reads the messages
(from the queue/Channel--- I'm not sure about this)
Issue no. 2:
If you see the code of the com.example.CustomChannel.java,
doReceive() deletes the file created in the doSend() method.
I believe that the Messages are read from the channel only by a doReceive().
However in the sample code the messages/files are not deleted from the folder.
Is this a mistake in the CustomChannel.java (Does it not handle threads
properly? I think the use of a Semaphore would solve the problem, but please correct me
if I am wrong).
is it that SI is passing the messages from the memory instead of doReceive() from the channels ?
Issue No. 3: Persistence (No serialVersionUID in the Serializable classes).
My intention of this custom channel is to persist messages from one application.
Read them in another application!
This was not possible because GenericMessage, MessageHeader Classes dont have a
serialVersionUID variable defined in them, hence I had to create one CustomMessage
and over-ride the default MessageHeader with the modified one I have.
The modified Quote sample is divided into two applications
Persists ticker messages in the Custom-Channel folder.
Reads the ticker messages from Pub-Integration in the same Custom-Channel folder.
To make Subscriber work, I create a dummy publisher publish default ticker messages
which I dont intend to read in the Subscriber, but I am interested in the other ticker
messages from the Pub-Integration.
However as I suspect in the Issue No: 2, The Subscriber can read only messages
Published from Publisher in the same JVM.
Please reply with advices on how to make the CustomChannel.java work with the
Or is it not the way to use SI ?