[
https://jira.jboss.org/jira/browse/JBESB-2065?page=com.atlassian.jira.plu...
]
Bernd Ruecker commented on JBESB-2065:
--------------------------------------
In our environment we needed MapMessages to work, so we configured our own JmsComposer:
<jms-provider name="JBossMessaging"
connection-factory="XAConnectionFactory">
<property name="composer-class"
value="...JmsGatewayComposer"/>
This class is basically a copy of PackageJmsMessageContents but adds the MapMessages in
the setESBMessageBody method:
private void setESBMessageBody(final javax.jms.Message fromJMSMessage,
final Message toESBMessage) throws JMSException, IOException,
MessageDeliverException {
byte[] bodyAsBytes = null;
if (fromJMSMessage instanceof TextMessage) {
final String text = ((TextMessage) fromJMSMessage).getText();
payloadProxy.setPayload(toESBMessage, text);
} else if (fromJMSMessage instanceof BytesMessage) {
final BytesMessage jBytes = (BytesMessage) fromJMSMessage;
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] ba = new byte[1000];
int iQread;
while (-1 != (iQread = jBytes.readBytes(ba))) {
if (iQread > 0)
out.write(ba, 0, iQread);
out.close();
}
bodyAsBytes = out.toByteArray();
payloadProxy.setPayload(toESBMessage, bodyAsBytes);
} else if (fromJMSMessage instanceof ObjectMessage) {
final Object object = ((ObjectMessage) fromJMSMessage).getObject();
payloadProxy.setPayload(toESBMessage, object);
// added MapMessage
} else if (fromJMSMessage instanceof MapMessage) {
MapMessage mapMessage = (MapMessage)fromJMSMessage;
Enumeration mapNames = mapMessage.getMapNames();
while (mapNames.hasMoreElements()) {
String key = (String) mapNames.nextElement();
toESBMessage.getBody().add(
key,
mapMessage.getObject(key));
}
// not used payloadProxy because we have more than just one object
// finished change in original class
} else {
log.warn("Message type "
+ fromJMSMessage.getClass().getSimpleName()
+ " not supported - Message is ignored");
}
We just added the lines between the comments. Maybe this can be committed to the core ESB
as well? It is pretty annoying that you have to cinfigure support for MapMessages on every
service in your ESB. And since ESB is a lot abour messaging it should support all JMS
types I think.
JMSGatewayListener: Add support for missing JMS Message types
-------------------------------------------------------------
Key: JBESB-2065
URL:
https://jira.jboss.org/jira/browse/JBESB-2065
Project: JBoss ESB
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: Transports
Affects Versions: 4.4
Reporter: Tom Fennelly
Fix For: 4.x
It's missing support for some of the JMS Message types e.g. MapMessage. Should
support them all.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira