Package org.springframework.jms.core

Examples of org.springframework.jms.core.JmsTemplate.execute()


        SessionCallback<javax.jms.Message> sc = new SessionCallback<javax.jms.Message>() {
            public javax.jms.Message doInJms(Session session) throws JMSException {
                return JMSUtils.createAndSetPayload(testBytes, session, JMSConstants.BYTE_MESSAGE_TYPE);
            }
        };
        javax.jms.Message message = jmsTemplate.execute(sc);
       
        // The ibm jdk finalizes conduit (during most runs of this test) and
        // causes it to fail unless we reference the conduit here after the
        // jmsTemplate.execute() call.
        assertNotNull("Conduit is null", conduit);
View Full Code Here


        final JmsTemplate jmsTemplate = JMSFactory.createJmsTemplate(jmsConfig, null);

        Thread t = new Thread() {
            public void run() {
                @SuppressWarnings("unchecked")
                Destination destination = (Destination)jmsTemplate.execute(new SessionCallback() {
                    public Object doInJms(Session session) throws JMSException {
                        DestinationResolver resolv = jmsTemplate.getDestinationResolver();
                        return resolv.resolveDestinationName(session, jmsConfig.getTargetDestination(),
                                                             false);
                    }
View Full Code Here

                        return message;
                    }
                };
                   
                @SuppressWarnings("unchecked")
                Destination destination2 = (Destination)jmsTemplate.execute(new SessionCallback() {
                    public Object doInJms(Session session) throws JMSException {
                        DestinationResolver resolv = jmsTemplate.getDestinationResolver();
                        return resolv.resolveDestinationName(session,
                                                             jmsConfig.getReplyDestination(),
                                                             false);
View Full Code Here

            public Object doInJms(Session session) throws JMSException {
                return JMSUtils.createAndSetPayload(testBytes, session, JMSConstants.BYTE_MESSAGE_TYPE);
            }
        };
        @SuppressWarnings("unchecked")
        javax.jms.Message message = (javax.jms.Message)jmsTemplate.execute(sc);
       
        // The ibm jdk finalizes conduit (during most runs of this test) and
        // causes it to fail unless we reference the conduit here after the
        // jmsTemplate.execute() call.
        assertNotNull("Conduit is null", conduit);
View Full Code Here

        conduit.prepare(msg);
        final byte[] testBytes = testMsg.getBytes(Charset.defaultCharset().name()); // TODO encoding
        JMSConfiguration jmsConfig = conduit.getJmsConfig();
        JmsTemplate jmsTemplate = new JmsTemplate();
        jmsTemplate.setConnectionFactory(jmsConfig.getOrCreateWrappedConnectionFactory());
        javax.jms.Message message = (javax.jms.Message)jmsTemplate.execute(new SessionCallback() {
            public Object doInJms(Session session) throws JMSException {
                return JMSUtils.createAndSetPayload(testBytes, session, JMSConstants.BYTE_MESSAGE_TYPE);
            }
        });
       
View Full Code Here

        conduit.prepare(msg);
        final byte[] testBytes = testMsg.getBytes(Charset.defaultCharset().name()); // TODO encoding
        JMSConfiguration jmsConfig = conduit.getJmsConfig();
        JmsTemplate jmsTemplate = new JmsTemplate();
        jmsTemplate.setConnectionFactory(jmsConfig.getOrCreateWrappedConnectionFactory());
        javax.jms.Message message = (javax.jms.Message)jmsTemplate.execute(new SessionCallback() {
            public Object doInJms(Session session) throws JMSException {
                return JMSUtils.createAndSetPayload(testBytes, session, JMSConstants.BYTE_MESSAGE_TYPE);
            }
        });
        assertTrue("Message should have been of type BytesMessage ", message instanceof BytesMessage);
View Full Code Here

        final JmsTemplate jmsTemplate = JMSFactory.createJmsTemplate(jmsConfig, null);

        Thread t = new Thread() {
            public void run() {
                @SuppressWarnings("unchecked")
                Destination destination = (Destination)jmsTemplate.execute(new SessionCallback() {
                    public Object doInJms(Session session) throws JMSException {
                        DestinationResolver resolv = jmsTemplate.getDestinationResolver();
                        return resolv.resolveDestinationName(session, jmsConfig.getTargetDestination(),
                                                             false);
                    }
View Full Code Here

                        return message;
                    }
                };
                   
                @SuppressWarnings("unchecked")
                Destination destination2 = (Destination)jmsTemplate.execute(new SessionCallback() {
                    public Object doInJms(Session session) throws JMSException {
                        DestinationResolver resolv = jmsTemplate.getDestinationResolver();
                        return resolv.resolveDestinationName(session,
                                                             jmsConfig.getReplyDestination(),
                                                             false);
View Full Code Here

    given(con.createSession(true, Session.AUTO_ACKNOWLEDGE)).willReturn(session);

    JmsTransactionManager tm = new JmsTransactionManager(cf);
    TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
    JmsTemplate jt = new JmsTemplate(cf);
    jt.execute(new SessionCallback<Void>() {
      @Override
      public Void doInJms(Session sess) {
        assertTrue(sess == session);
        return null;
      }
View Full Code Here

    given(con.createSession(true, Session.AUTO_ACKNOWLEDGE)).willReturn(session);

    JmsTransactionManager tm = new JmsTransactionManager(cf);
    TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
    JmsTemplate jt = new JmsTemplate(cf);
    jt.execute(new SessionCallback<Void>() {
      @Override
      public Void doInJms(Session sess) {
        assertTrue(sess == session);
        return null;
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.