hi,
We're trying to send a file via an si:channel which will be converted to a JMS message. We'd rather not use the s-i API's directly in our code. The following code/config works exactly as we'd like;
Code:Message<byte[]> m = MessageBuilder.withPayload("this could be a real file".getBytes()) .setHeader("file.name", "target/file/name.txt") .build(); MessageChannel out = (MessageChannel) context.getBean("gw-out"); out.send(m);In the above example, a JMS BytesMessage with an appropriate JMSProperty for the 'file.name' header is placed on the queue. So far, so good - the consumer on that queue gets exactly what it needs from the above setup.Code:<si:channel id="gw-out"/> <jms:outbound-channel-adapter connection-factory="connectionFactory" channel="gw-out" destination-name="queue.dataupload.new"/>
Now, when I try to further this by removing the dependencies on Spring API's, I create a gateway interface..
.. add the following XML snippet..Code:public interface Gateway { void send(Object o); }
.. and begin to amend the client code..Code:<si:gateway id="gateway" service-interface="test.Gateway" default-request-channel="gw-out"/>
What do I replace the MessageBuilder with?Code:Gateway g = (Gateway) context.getBean("gateway"); Object o = ?? // what goes here to replace the Spring MessageBuilder above? g.send(o);
Cheers!
Darren.
NB:
Even if I leave the MessageBuilder in place, but still use the gateway, I have a new problem in that the actual GenericMessage instance gets serialized through the gateway. No longer do I have a BytesMessage on my JMS queue with a JMSProperty set with the 'file.name' value.. I have an ObjectMessage and a classname that the consumer knows nothing about. This appears to contradict the current ref docs that suggest the payload should be extracted.. I may have read this bit wrong of course.


Reply With Quote
