Examples of convertAndSend()


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

  private JmsMethodInvocationRecoverer<String> itemReader = new JmsMethodInvocationRecoverer<String>();

  @Test
  public void testRecoverWithNoDestination() throws Exception {
    JmsOperations jmsTemplate = mock(JmsOperations.class);
    jmsTemplate.convertAndSend("foo");

    itemReader.setJmsTemplate(jmsTemplate);
    itemReader.recover(new Object[] { "foo" }, null);

  }
View Full Code Here

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

  JmsItemWriter<String> itemWriter = new JmsItemWriter<String>();

  @Test
  public void testNoItemTypeSunnyDay() throws Exception {
    JmsOperations jmsTemplate = mock(JmsOperations.class);
    jmsTemplate.convertAndSend("foo");
    jmsTemplate.convertAndSend("bar");

    itemWriter.setJmsTemplate(jmsTemplate);
    itemWriter.write(Arrays.asList("foo", "bar"));
  }
View Full Code Here

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

  @Test
  public void testNoItemTypeSunnyDay() throws Exception {
    JmsOperations jmsTemplate = mock(JmsOperations.class);
    jmsTemplate.convertAndSend("foo");
    jmsTemplate.convertAndSend("bar");

    itemWriter.setJmsTemplate(jmsTemplate);
    itemWriter.write(Arrays.asList("foo", "bar"));
  }
 
View Full Code Here

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

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.rollback(status);
    } catch(Exception ex) {
      ex.printStackTrace();
      transactionManager.rollback(status);
      fail("Undesired exception.");
View Full Code Here

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

      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

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

      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

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


    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

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

        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

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

        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
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.