Package org.springframework.jms.core

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


    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);
      JmsTemplate template=new JmsTemplate(getConnectionFactory());
      template.convertAndSend(queue,TEST_MESSAGE);
      transactionManager.commit(status);
    } catch(Exception ex) {
      ex.printStackTrace();
      transactionManager.rollback(status);
      fail("Undesired exception.");
View Full Code Here


    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);
      JmsTemplate template=new JmsTemplate(getConnectionFactory());
      template.convertAndSend(queue,TEST_MESSAGE);
      transactionManager.rollback(status);
    } catch(Exception ex) {
      ex.printStackTrace();
      transactionManager.rollback(status);
      fail("Undesired exception.");
View Full Code Here

      jdbcTemplate.update(UPDATE_FIELD_REQUEST,
          new Object[] {TEST_FIELD_VALUE,new Integer(FIELD_ID)},
          new int[] {Types.VARCHAR,Types.INTEGER});
      //JMS
      JmsTemplate jmsTemplate=new JmsTemplate(getConnectionFactory());
      jmsTemplate.convertAndSend(queue,TEST_MESSAGE);

      transactionManager.commit(status);
    } catch(Exception ex) {
      ex.printStackTrace();
      transactionManager.rollback(status);
View Full Code Here

      jdbcTemplate.update(UPDATE_FIELD_REQUEST,
          new Object[] {TEST_FIELD_VALUE,new Integer(FIELD_ID)},
          new int[] {Types.VARCHAR,Types.INTEGER});
      //JMS
      JmsTemplate jmsTemplate=new JmsTemplate(getConnectionFactory());
      jmsTemplate.convertAndSend(queue,TEST_MESSAGE);

      transactionManager.rollback(status);
    } catch(Exception ex) {
      ex.printStackTrace();
      transactionManager.rollback(status);
View Full Code Here


    public void sendMessage(String text) throws JmsException {
        JmsTemplate template = new JmsTemplate(connectionFactory);
        template.setPubSubDomain(true);
        template.convertAndSend("myTopic", text);
    }

    protected void setUp() throws Exception {
        applicationContext = new ClassPathXmlApplicationContext(getSpringConfig());
        connectionFactory = (ConnectionFactory) applicationContext.getBean("jmsFactory");
View Full Code Here

        JmsTemplate jmsTemplate = new JmsTemplate();
        jmsTemplate.setConnectionFactory(new PooledConnectionFactory(connectionFactory));
        jmsTemplate.setPubSubDomain(true);
        jmsTemplate.afterPropertiesSet();
        jmsTemplate.convertAndSend("destinationTopic", "<hello>world</hello>");
        receiver.getMessageList().assertMessagesReceived(1);
        Thread.sleep(500);
    }

    public void testConsumerDefaultInOut() throws Exception {
View Full Code Here

        JmsTemplate template = (JmsTemplate) ctx.getBean("jmsTemplate");
        final Destination destination = (Destination) ctx.getBean("destination");

        for(int x = 0; x < 2; x++) {
            System.out.println("Sending Message: " + x);
            template.convertAndSend(destination, "Foo: " + x);
            Thread.sleep(400);
        }
    }
}
View Full Code Here

        JmsTemplate jmsTemplate = new JmsTemplate();
        jmsTemplate.setConnectionFactory(connectionFactory);
        jmsTemplate.setPubSubDomain(true);

        try {
            jmsTemplate.convertAndSend(destinationName, jsonMapper.toJson(map));
        } catch (IOException ex) {
            logger.error(ex.getMessage());
        }
    }
View Full Code Here

        JmsTemplate jmsTemplate = new JmsTemplate();
        jmsTemplate.setConnectionFactory(connectionFactory);
        jmsTemplate.setPubSubDomain(true);

        try {
            jmsTemplate.convertAndSend(destinationName,
                    jsonMapper.toJson(object));
        } catch (IOException ex) {
            logger.error(ex.getMessage());
        }
    }
View Full Code Here

        JmsTemplate jmsTemplate = new JmsTemplate();
        jmsTemplate.setConnectionFactory(connectionFactory);
        jmsTemplate.setPubSubDomain(false);

        try {
            jmsTemplate.convertAndSend(destinationName,
                    jsonMapper.toJson(object));
        } catch (IOException ex) {
            logger.error(ex.getMessage());
        }
    }
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.