[jboss-svn-commits] JBL Code SVN: r18147 - labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/notification.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jan 26 07:42:49 EST 2008
Author: mark.little at jboss.com
Date: 2008-01-26 07:42:49 -0500 (Sat, 26 Jan 2008)
New Revision: 18147
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1514
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java 2008-01-26 11:45:20 UTC (rev 18146)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java 2008-01-26 12:42:49 UTC (rev 18147)
@@ -182,7 +182,7 @@
protected int[] deliveryModes;
/**
- * Priorities for JMS Messages sen by this notifier
+ * Priorities for JMS Messages seen by this notifier
*/
protected int[] priorities;
@@ -234,49 +234,60 @@
*/
public void sendNotification (org.jboss.soa.esb.message.Message esbMessage) throws NotificationException
{
- try
+ try
+ {
+ Message jmsMessage = null;
+ Object obj = payloadProxy.getPayload(esbMessage);
+
+ if (MessageType.JAVA_SERIALIZED.equals(esbMessage.getType()))
{
- Message jmsMessage = null;
- Object obj = payloadProxy.getPayload(esbMessage);
+ if(obj == null) {
+ // create a null payload message...
+ jmsMessage = sessions[0].createObjectMessage(null);
+ } else if(obj instanceof byte[]) {
+ jmsMessage = sessions[0].createObjectMessage((byte[]) obj);
+ } else {
+ throw new NotificationException("Expected payload type for '" + MessageType.JAVA_SERIALIZED + "' is byte[]. Recieved '" + obj.getClass().getName() + "'.");
+ }
+ }
+ else
+ {
+ String content = null;
+ if (obj instanceof byte[]) {
+ content = new String((byte[]) obj);
+ } else if(obj != null) {
+ content = obj.toString();
+ }
+ jmsMessage = sessions[0].createTextMessage(content);
+ }
- if (MessageType.JAVA_SERIALIZED.equals(esbMessage.getType()))
- {
- if(obj == null) {
- // create a null payload message...
- jmsMessage = sessions[0].createObjectMessage(null);
- } else if(obj instanceof byte[]) {
- jmsMessage = sessions[0].createObjectMessage((byte[]) obj);
- } else {
- throw new NotificationException("Expected payload type for '" + MessageType.JAVA_SERIALIZED + "' is byte[]. Recieved '" + obj.getClass().getName() + "'.");
- }
- }
- else
- {
- String content = null;
- if (obj instanceof byte[]) {
- content = new String((byte[]) obj);
- } else if(obj != null) {
- content = obj.toString();
- }
- jmsMessage = sessions[0].createTextMessage(content);
- }
-
- setJMSProperties( esbMessage, jmsMessage );
-
- for (Iterator II = m_oProps.keySet().iterator(); II.hasNext();)
- {
- String sKey = (String) II.next();
- String sVal = m_oProps.getProperty(sKey);
- jmsMessage.setStringProperty(sKey, sVal);
- }
- sendToAll(jmsMessage);
+ setJMSProperties( esbMessage, jmsMessage );
+
+ for (Iterator II = m_oProps.keySet().iterator(); II.hasNext();)
+ {
+ String sKey = (String) II.next();
+ String sVal = m_oProps.getProperty(sKey);
+ jmsMessage.setStringProperty(sKey, sVal);
}
- catch (JMSException ex)
- {
- throw new NotificationException(ex);
- } catch (MessageDeliverException e) {
- throw new NotificationException(e);
- }
+ sendToAll(jmsMessage);
+ }
+ catch (JMSException ex)
+ {
+ throw new NotificationException(ex);
+ } catch (MessageDeliverException e) {
+ throw new NotificationException(e);
+ }
+ finally
+ {
+ /*
+ * Why do we create multiple pools but only ever use one?
+ *
+ * Don't forget to put the session back into the pool!
+ */
+
+ if (connectionPools != null)
+ connectionPools[0].closeSession(sessions[0]);
+ }
} // __________________________________
/**
More information about the jboss-svn-commits
mailing list