Package org.apache.camel.component.sjms

Examples of org.apache.camel.component.sjms.MessageProducerResources


        }
    }

    @Override
    public MessageProducerResources doCreateProducerModel() throws Exception {
        MessageProducerResources answer;
        Connection conn = getConnectionResource().borrowConnection();
        try {
            Session session = conn.createSession(isEndpointTransacted(), getAcknowledgeMode());
            Destination destination = getEndpoint().getDestinationCreationStrategy().createDestination(session, getDestinationName(), isTopic());
            MessageProducer messageProducer = JmsObjectFactory.createMessageProducer(session, destination, isPersistent(), getTtl());

            answer = new MessageProducerResources(session, messageProducer);

        } catch (Exception e) {
            log.error("Unable to create the MessageProducer", e);
            throw e;
        } finally {
View Full Code Here


     * @return
     * @throws Exception
     */
    @Override
    public MessageProducerResources doCreateProducerModel() throws Exception {
        MessageProducerResources answer;
        Connection conn = getConnectionResource().borrowConnection();
        try {
            TransactionCommitStrategy commitStrategy = null;
            if (isEndpointTransacted()) {
                commitStrategy = getCommitStrategy() == null ? new DefaultTransactionCommitStrategy() : getCommitStrategy();
            }
            Session session = conn.createSession(isEndpointTransacted(), getAcknowledgeMode());
            Destination destination = getEndpoint().getDestinationCreationStrategy().createDestination(session, getDestinationName(), isTopic());
            MessageProducer messageProducer = JmsObjectFactory.createMessageProducer(session, destination, isPersistent(), getTtl());

            answer = new MessageProducerResources(session, messageProducer, commitStrategy);

        } catch (Exception e) {
            log.error("Unable to create the MessageProducer", e);
            throw e;
        } finally {
View Full Code Here

     * @return
     * @throws Exception
     */
    @Override
    public MessageProducerResources doCreateProducerModel() throws Exception {
        MessageProducerResources answer = null;
        Connection conn = null;
        try {
            conn = getConnectionResource().borrowConnection();
            TransactionCommitStrategy commitStrategy = null;
            Session session;

            if (isEndpointTransacted()) {
                if (getCommitStrategy() != null) {
                    commitStrategy = getCommitStrategy();
                } else {
                    commitStrategy = new DefaultTransactionCommitStrategy();
                }
                session = conn.createSession(true, getAcknowledgeMode());
            } else {
                session = conn.createSession(false, getAcknowledgeMode());
            }

            MessageProducer messageProducer = JmsObjectFactory.createMessageProducer(session, getDestinationName(), isTopic(), isPersistent(), getTtl());

            answer = new MessageProducerResources(session, messageProducer, commitStrategy);
        } catch (Exception e) {
            log.error("Unable to create the MessageProducer: " + e.getLocalizedMessage());
        } finally {
            if (conn != null) {
                getConnectionResource().returnConnection(conn);
View Full Code Here

        }
    }

    @Override
    public MessageProducerResources doCreateProducerModel() throws Exception {
        MessageProducerResources answer = null;
        Connection conn = null;
        try {
            MessageProducer messageProducer = null;
            Session session = null;

            conn = getConnectionResource().borrowConnection();
            if (isEndpointTransacted()) {
                session = conn.createSession(true, getAcknowledgeMode());
            } else {
                session = conn.createSession(false, getAcknowledgeMode());
            }

            messageProducer = JmsObjectFactory.createMessageProducer(session, getDestinationName(), isTopic(), isPersistent(), getTtl());

            if (session == null) {
                throw new CamelException("Message Consumer Creation Exception: Session is NULL");
            }
            if (messageProducer == null) {
                throw new CamelException("Message Consumer Creation Exception: MessageProducer is NULL");
            }

            answer = new MessageProducerResources(session, messageProducer);

        } catch (Exception e) {
            log.error("Unable to create the MessageProducer: " + e.getLocalizedMessage());
        } finally {
            if (conn != null) {
View Full Code Here

TOP

Related Classes of org.apache.camel.component.sjms.MessageProducerResources

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.