]> git.mxchange.org Git - jcoreee.git/commitdiff
added method sendMessage()
authorRoland Häder <roland@mxchange.org>
Tue, 17 May 2016 15:10:12 +0000 (17:10 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 17 May 2016 15:10:12 +0000 (17:10 +0200)
src/org/mxchange/jcoreee/database/BaseDatabaseBean.java

index 9e82877a37bf4e0e98e6cc88e11ba6124ea9520d..302daeb9e8be2365b0a9a36123ccd326c5295254 100644 (file)
@@ -18,6 +18,9 @@ package org.mxchange.jcoreee.database;
 
 import java.io.Serializable;
 import java.text.MessageFormat;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
@@ -84,4 +87,23 @@ public abstract class BaseDatabaseBean implements Serializable {
                return this.loggerBeanLocal;
        }
 
+       /**
+        * Sends given message to configured queue
+        * <p>
+        * @param message Message to send
+        * @param messageProducer Message producer
+        * <p>
+        * @throws JMSException if something went wrong
+        */
+       protected void sendMessage (final ObjectMessage message, final MessageProducer messageProducer) throws JMSException {
+               // The parameter should be valid
+               if (null == message) {
+                       // Throw NPE
+                       throw new NullPointerException("message is null"); //NOI18N
+               }
+
+               // Send it
+               messageProducer.send(message);
+       }
+
 }