From 1f200bd0e0461cdd67848d63365de8e1c507f29a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 17 May 2016 17:10:12 +0200 Subject: [PATCH] added method sendMessage() --- .../jcoreee/database/BaseDatabaseBean.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/org/mxchange/jcoreee/database/BaseDatabaseBean.java b/src/org/mxchange/jcoreee/database/BaseDatabaseBean.java index 9e82877..302daeb 100644 --- a/src/org/mxchange/jcoreee/database/BaseDatabaseBean.java +++ b/src/org/mxchange/jcoreee/database/BaseDatabaseBean.java @@ -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 + *

+ * @param message Message to send + * @param messageProducer Message producer + *

+ * @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); + } + } -- 2.39.5