Brad,
Currently, the easiest way to add the JMSReplyTo property would be to set a MessageConverter on the JmsTemplate. For example:
Code:
<si:jms-target jms-template="jmsTemplate" channel="outChannel"/>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="defaultDestinationName" value="queue.out"/>
<property name="messageConverter">
<bean class="example.CustomConverter">
<property name="replyTo" ref="replyDestination"/>
</bean>
</property>
</bean>
Then CustomConverter can extend Spring's SimpleMessageConverter, and do something like the following:
Code:
public void setReplyTo(Destination replyTo) {
this.replyTo = replyTo;
}
public Message toMessage(Object o, Session s) {
Message message = super.toMessage(o, s);
message.setJMSReplyTo(this.replyTo);
return message;
}
Moving forward, the Spring Integration JmsTargetAdapter should probably be able to recognize these common JMS headers. The keys can be provided as static fields in the adapter itself (e.g. JmsTargetAdapter.JMS_REPLY_TO). Then, what you are trying to do would be much easier. I will add this right now as an M2 issue in Jira.
To answer your question about the header, you can add attributes like this:
Code:
message.getHeader().setAttribute("key", value);
Hope that helps,
Mark