MmarcoM
Dec 29th, 2009, 09:23 AM
Hello all,
i have a spring app where i post message to a common channel (event channel), where a rounter redirects the message to other channels (according to value of one of message's property).
the message being sent is my custom class, which just contains a String and an extra property.
i have defined this channel along with its adapter for creating a file out of a message
<si:channel id="fileChannel"/>
<file:outbound-channel-adapter id="filesOut"
channel="fileChannel"
directory="file:/c:/SpringInteg/files"/>
the problem is that i am receiving this exception
ARN - Execution of JMS message listener failed [org.springframework.jms.listener.DefaultMessageLis tenerContainer#0-1]
org.springframework.integration.message.MessageHan dlingException: failed to write Message payload to file
at org.springframework.integration.file.FileWritingMe ssageHandler.handleMessage(FileWritingMessageHandl er.java:109)
at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToHandler(AbstractDispatche r.java:85)
at org.springframework.integration.dispatcher.Abstrac tUnicastDispatcher.dispatch(AbstractUnicastDispatc her.java:54)
at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:56)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:94)
at org.springframework.integration.channel.MessageCha nnelTemplate.doSend(MessageChannelTemplate.java:22 3)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.router.AbstractMes sageRouter.handleMessageInternal(AbstractMessageRo uter.java:76)
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:48)
at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToHandler(AbstractDispatche r.java:85)
at org.springframework.integration.dispatcher.Abstrac tUnicastDispatcher.dispatch(AbstractUnicastDispatc her.java:54)
at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:56)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.MessageCha nnelTemplate.doSend(MessageChannelTemplate.java:22 2)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendReplyMessage(Abstra ctReplyProducingMessageHandler.java:119)
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:107)
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:48)
at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToHandler(AbstractDispatche r.java:85)
at org.springframework.integration.dispatcher.Abstrac tUnicastDispatcher.dispatch(AbstractUnicastDispatc her.java:54)
at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:56)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:94)
at org.springframework.integration.channel.MessageCha nnelTemplate.doSend(MessageChannelTemplate.java:22 3)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:168)
at org.springframework.integration.jms.ChannelPublish ingJmsMessageListener.onMessage(ChannelPublishingJ msMessageListener.java:203)
at org.springframework.jms.listener.AbstractMessageLi stenerContainer.doInvokeListener(AbstractMessageLi stenerContainer.java:506)
at org.springframework.jms.listener.AbstractMessageLi stenerContainer.invokeListener(AbstractMessageList enerContainer.java:463)
at org.springframework.jms.listener.AbstractMessageLi stenerContainer.doExecuteListener(AbstractMessageL istenerContainer.java:435)
at org.springframework.jms.listener.AbstractPollingMe ssageListenerContainer.doReceiveAndExecute(Abstrac tPollingMessageListenerContainer.java:322)
at org.springframework.jms.listener.AbstractPollingMe ssageListenerContainer.receiveAndExecute(AbstractP ollingMessageListenerContainer.java:260)
at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.invokeL istener(DefaultMessageListenerContainer.java:944)
at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.run(Def aultMessageListenerContainer.java:868)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: unsupported Message payload type [com.sample.domain.TestMessage]
at org.springframework.integration.file.FileWritingMe ssageHandler.handleMessage(FileWritingMessageHandl er.java:103)
... 35 more
Which in a way i am expecting because i am using a custom message, and the default adapter cannot convert it to a String.
I guess i should use a transformer, but i am not clear on how........ as transformer normally
does a transformation between 2 channels.
my workflow is as follows
eventChannel ---> fileChannel (where adapter will get the message and hopefully store to a file)
if i use a tranformer, shall i amend the workflow as follows?
eventChannel --->tmpChannel--->fileChannel ?
or can i associate a transformer directly to teh file adapter?
anyone could clarifiy?
regards
marco
i have a spring app where i post message to a common channel (event channel), where a rounter redirects the message to other channels (according to value of one of message's property).
the message being sent is my custom class, which just contains a String and an extra property.
i have defined this channel along with its adapter for creating a file out of a message
<si:channel id="fileChannel"/>
<file:outbound-channel-adapter id="filesOut"
channel="fileChannel"
directory="file:/c:/SpringInteg/files"/>
the problem is that i am receiving this exception
ARN - Execution of JMS message listener failed [org.springframework.jms.listener.DefaultMessageLis tenerContainer#0-1]
org.springframework.integration.message.MessageHan dlingException: failed to write Message payload to file
at org.springframework.integration.file.FileWritingMe ssageHandler.handleMessage(FileWritingMessageHandl er.java:109)
at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToHandler(AbstractDispatche r.java:85)
at org.springframework.integration.dispatcher.Abstrac tUnicastDispatcher.dispatch(AbstractUnicastDispatc her.java:54)
at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:56)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:94)
at org.springframework.integration.channel.MessageCha nnelTemplate.doSend(MessageChannelTemplate.java:22 3)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.router.AbstractMes sageRouter.handleMessageInternal(AbstractMessageRo uter.java:76)
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:48)
at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToHandler(AbstractDispatche r.java:85)
at org.springframework.integration.dispatcher.Abstrac tUnicastDispatcher.dispatch(AbstractUnicastDispatc her.java:54)
at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:56)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.MessageCha nnelTemplate.doSend(MessageChannelTemplate.java:22 2)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendReplyMessage(Abstra ctReplyProducingMessageHandler.java:119)
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:107)
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:48)
at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToHandler(AbstractDispatche r.java:85)
at org.springframework.integration.dispatcher.Abstrac tUnicastDispatcher.dispatch(AbstractUnicastDispatc her.java:54)
at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:56)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:94)
at org.springframework.integration.channel.MessageCha nnelTemplate.doSend(MessageChannelTemplate.java:22 3)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:168)
at org.springframework.integration.jms.ChannelPublish ingJmsMessageListener.onMessage(ChannelPublishingJ msMessageListener.java:203)
at org.springframework.jms.listener.AbstractMessageLi stenerContainer.doInvokeListener(AbstractMessageLi stenerContainer.java:506)
at org.springframework.jms.listener.AbstractMessageLi stenerContainer.invokeListener(AbstractMessageList enerContainer.java:463)
at org.springframework.jms.listener.AbstractMessageLi stenerContainer.doExecuteListener(AbstractMessageL istenerContainer.java:435)
at org.springframework.jms.listener.AbstractPollingMe ssageListenerContainer.doReceiveAndExecute(Abstrac tPollingMessageListenerContainer.java:322)
at org.springframework.jms.listener.AbstractPollingMe ssageListenerContainer.receiveAndExecute(AbstractP ollingMessageListenerContainer.java:260)
at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.invokeL istener(DefaultMessageListenerContainer.java:944)
at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.run(Def aultMessageListenerContainer.java:868)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: unsupported Message payload type [com.sample.domain.TestMessage]
at org.springframework.integration.file.FileWritingMe ssageHandler.handleMessage(FileWritingMessageHandl er.java:103)
... 35 more
Which in a way i am expecting because i am using a custom message, and the default adapter cannot convert it to a String.
I guess i should use a transformer, but i am not clear on how........ as transformer normally
does a transformation between 2 channels.
my workflow is as follows
eventChannel ---> fileChannel (where adapter will get the message and hopefully store to a file)
if i use a tranformer, shall i amend the workflow as follows?
eventChannel --->tmpChannel--->fileChannel ?
or can i associate a transformer directly to teh file adapter?
anyone could clarifiy?
regards
marco