Package javax.jms

Examples of javax.jms.QueueSender.send()


      qc.start();
      int i;
      for (i = 0; i < 10; i++) {
        msg.setText("Test number " + i);
        qsend.send(msg);
      }

      qs.commit();
      System.out.println(i + " messages sent.");
     
View Full Code Here


            session = cnn.createQueueSession( transacted, QueueSession.AUTO_ACKNOWLEDGE );

            ObjectMessage msg = session.createObjectMessage( obj );

            sender = session.createSender( queue );
            sender.send( msg );
        }
        finally
        {
            if ( sender != null )
            {
View Full Code Here

      {
        try
        {
          TextMessage message = mqCon.createTextMessage();
          message.setText((String) e.nextElement());
          qs.send(message);
        }
        catch (JMSException ex)
        {
          System.out.println("Exception gefangen!");
          ex.printStackTrace();
View Full Code Here

        LOG.log(Level.FINE, "client sending request: ",  message);

        if (queueDestinationStyle) {
            QueueSender sender = (QueueSender)pooledSession.producer();
            sender.setTimeToLive(ttl);
            sender.send((Queue)targetDestination, message, deliveryMode, priority, ttl);
        } else {
            TopicPublisher publisher = (TopicPublisher)pooledSession.producer();
            publisher.setTimeToLive(ttl);
            publisher.publish((Topic)targetDestination, message, deliveryMode, priority, ttl);
        }
View Full Code Here

        QueueSender queueSender = queueSession.createSender(timerQueue);

        // Send message
        TextMessage message = queueSession.createTextMessage();
        message.setText("Sending a message");
        queueSender.send(message);
        System.out.println(" SLSB -> Message sent");

        // Close JMS objects
        queueSender.close();
        queueSession.close();
View Full Code Here

            System.out.println("Message [" + message.getJMSMessageID() + ", text:" + text + "] sent");
        }

        message = queueSession.createTextMessage();
        message.setText("Message that should be accepted after several attempts");
        queueSenderContext.send(message);

        // Close JMS objects
        queueSender.close();
        queueSenderContext.close();
        queueSession.close();
View Full Code Here

      m.setText("one");
      m.setBooleanProperty("targetMessage", false);

      QueueSender qsender = qs.createSender(queue);

      qsender.send(m);

      m.setText("two");
      m.setBooleanProperty("targetMessage", true);

      qsender.send(m);
View Full Code Here

      qsender.send(m);

      m.setText("two");
      m.setBooleanProperty("targetMessage", true);

      qsender.send(m);

      TextMessage rm = (TextMessage)qreceiver.receive(1000);

      assertEquals("two", rm.getText());
View Full Code Here

      final String contents = "Test Message Contents";
      final TextMessage message = sendSession.createTextMessage(contents);

      // Send the message
      final QueueSender sender = sendSession.createSender(queue);
      sender.send(message);
      log.info("Sent message " + message + " with contents: " + contents);

      // Clean up
      sendSession.close();
      connection.close();
View Full Code Here

      c.start();
      QueueSession s = c.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      QueueSender sender = s.createSender(queue);
     
      // Message 1
      sender.send(s.createTextMessage("Hey!"));

      SimpleValue messageCount1 = (SimpleValue) messageCount.getValue();
      //assertTrue((Integer) (messageCount1).getValue() > 0);
      assertEquals(1, messageCount1.getValue());
      //CompositeValue messageCounterCV = (CompositeValue) messageCounter.getValue();
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.