interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/ToTopicSender.java
/**
     * @param object    the object
     * @param topicName name of the topic you want to use
     */
@param object    the object
@param topicName name of the topic you want to use
@param object the object @param topicName name of the topic you want to use
protected void send(Serializable object, String topicName) {
        Connection connection = null;
        try {
            connection = this.pooledConnectionFactory.createConnection();
            Session session = null;
            try {
                session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                final Topic topic = session.createTopic(topicName);
                MessageProducer topicmp = null;
                try {
                    topicmp = session.createProducer(topic);
                    topicmp.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                    topicmp.send(this.getMessage(object, session));
                } finally {
                    if (topicmp != null) {
                        try {
                            topicmp.close();
                        } catch (final JMSException e) {
                            this.logger.warn("Can not close producer", e);
                        }
                    }
                }
            } finally {
                if (session != null) {
                    try {
                        session.close();
                    } catch (final JMSException e) {
                        this.logger.warn("Can not close session", e);
                    }
                }
            }
        } catch (JMSException | IOException e) {
            this.logger.error("Can not send message", e);
        } finally {
            if (connection != null) {
                try {
                    connection.close();
                } catch (final JMSException e) {
                    this.logger.warn("Can not close connection", e);
                }
            }
        }
    }
protected void send ( Serializable object , String topicName ) { Connection connection = null ; try { connection = this . pooledConnectionFactory . createConnection ( ) ; Session session = null ; try { session = connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; final Topic topic = session . createTopic ( topicName ) ; MessageProducer topicmp = null ; try { topicmp = session . createProducer ( topic ) ; topicmp . setDeliveryMode ( DeliveryMode . NON_PERSISTENT ) ; topicmp . send ( this . getMessage ( object , session ) ) ; } finally { if ( topicmp != null ) { try { topicmp . close ( ) ; } catch ( final JMSException e ) { this . logger . warn ( "Can not close producer" , e ) ; } } } } finally { if ( session != null ) { try { session . close ( ) ; } catch ( final JMSException e ) { this . logger . warn ( "Can not close session" , e ) ; } } } } catch ( JMSException | IOException e ) { this . logger . error ( "Can not send message" , e ) ; } finally { if ( connection != null ) { try { connection . close ( ) ; } catch ( final JMSException e ) { this . logger . warn ( "Can not close connection" , e ) ; } } } }
@param object    the object
 @param topicName name of the topic you want to use
@param object the object @param topicName name of the topic you want to use