/** * Creates an initialized <CODE>TextMessage</CODE> object. A * <CODE>TextMessage</CODE> object is used to send a message containing a * <CODE>String</CODE>. * * @param text the string used to initialize this message * @return an ActiveMQTextMessage * @throws JMSException if the JMS provider fails to create this message due * to some internal error. */ @Override public TextMessage createTextMessage(String text) throws JMSException { ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText(text); configureMessage(message); return message; }
@Setup(Level.Trial) public void init() throws MessageNotWriteableException { Tracing tracing = Tracing.newBuilder().spanReporter(Reporter.NOOP).build(); producer = new FakeMessageProducer(); message.setText("value"); tracingProducer = TracingMessageProducer.create(producer, JmsTracing.create(tracing)); }
ActiveMQTextMessage msg = new ActiveMQTextMessage(); msg.setConnection(connection); msg.setText(textMsg.getText()); activeMessage = msg; } else if (message instanceof BlobMessage) {
private static void sendMessage() throws Exception { // 创建 ActiveMQ 链接,设置 Broker URL ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); // 创造 JMS 链接 Connection connection = connectionFactory.createConnection(); // 创建会话 Session Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 创建消息目的 - Queue 名称为 "TEST" Destination destination = session.createQueue("TEST"); // 创建消息生产者 MessageProducer producer = session.createProducer(destination); // 创建消息 - 文本消息 ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText("Hello,World"); // 发送文本消息 producer.send(message); // 关闭消息生产者 producer.close(); // 关闭会话 session.close(); // 关闭连接 connection.close(); } }
private static void sendMessage() throws Exception { // 创建 ActiveMQ 链接,设置 Broker URL ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); // 创造 JMS 链接 Connection connection = connectionFactory.createConnection(); // 创建会话 Session Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 创建消息目的 - Queue 名称为 "TEST" Destination destination = session.createQueue("TEST"); // 创建消息生产者 MessageProducer producer = session.createProducer(destination); // 创建消息 - 文本消息 ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText("Hello,World"); // 发送文本消息 producer.send(message); // 关闭消息生产者 producer.close(); // 关闭会话 session.close(); // 关闭连接 connection.close(); } }
private static void sendMessage() throws Exception { // 创建 ActiveMQ 链接,设置 Broker URL ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); // 创造 JMS 链接 Connection connection = connectionFactory.createConnection(); // 创建会话 Session Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 创建消息目的 - Queue 名称为 "TEST" Destination destination = session.createQueue("TEST"); // 创建消息生产者 MessageProducer producer = session.createProducer(destination); // 创建消息 - 文本消息 ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText("Hello,World"); // 发送文本消息 producer.send(message); // 关闭消息生产者 producer.close(); // 关闭会话 session.close(); // 关闭连接 connection.close(); } }
public static ActiveMQTextMessage createTextMessage(String text) { ActiveMQTextMessage message = new ActiveMQTextMessage(); try { message.setText(text); } catch (MessageNotWriteableException ex) {} return message; }
public static ActiveMQTextMessage createTextMessage(String text) { ActiveMQTextMessage message = new ActiveMQTextMessage(); try { message.setText(text); } catch (MessageNotWriteableException ex) {} return message; }
/** * Creates an initialized <CODE>TextMessage</CODE> object. A * <CODE>TextMessage</CODE> object is used to send a message containing a * <CODE>String</CODE>. * * @param text the string used to initialize this message * @return an ActiveMQTextMessage * @throws JMSException if the JMS provider fails to create this message due * to some internal error. */ public TextMessage createTextMessage(String text) throws JMSException { ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText(text); configureMessage(message); return message; }
/** * Creates an initialized <CODE>TextMessage</CODE> object. A * <CODE>TextMessage</CODE> object is used to send a message containing a * <CODE>String</CODE>. * * @param text the string used to initialize this message * @return an ActiveMQTextMessage * @throws JMSException if the JMS provider fails to create this message due * to some internal error. */ @Override public TextMessage createTextMessage(String text) throws JMSException { ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText(text); configureMessage(message); return message; }
/** * Creates an initialized <CODE>TextMessage</CODE> object. A * <CODE>TextMessage</CODE> object is used to send a message containing a * <CODE>String</CODE>. * * @param text the string used to initialize this message * @return an ActiveMQTextMessage * @throws JMSException if the JMS provider fails to create this message due * to some internal error. */ @Override public TextMessage createTextMessage(String text) throws JMSException { ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText(text); configureMessage(message); return message; }
/** * Creates an initialized <CODE>TextMessage</CODE> object. A * <CODE>TextMessage</CODE> object is used to send a message containing a * <CODE>String</CODE>. * * @param text the string used to initialize this message * @return an ActiveMQTextMessage * @throws JMSException if the JMS provider fails to create this message due * to some internal error. */ @Override public TextMessage createTextMessage(String text) throws JMSException { ActiveMQTextMessage message = new ActiveMQTextMessage(); message.setText(text); configureMessage(message); return message; }
private static ActiveMQMessage createActiveMQMessage(Exchange exchange) throws JMSException { Object body = exchange.getIn().getBody(); if (body instanceof String) { ActiveMQTextMessage answer = new ActiveMQTextMessage(); answer.setText((String) body); return answer; } else if (body instanceof Serializable) { ActiveMQObjectMessage answer = new ActiveMQObjectMessage(); answer.setObject((Serializable) body); return answer; } else { return new ActiveMQMessage(); } }
private static ActiveMQMessage createActiveMQMessage(Exchange exchange) throws JMSException { Object body = exchange.getIn().getBody(); if (body instanceof String) { ActiveMQTextMessage answer = new ActiveMQTextMessage(); answer.setText((String) body); return answer; } else if (body instanceof Serializable) { ActiveMQObjectMessage answer = new ActiveMQObjectMessage(); answer.setObject((Serializable) body); return answer; } else { return new ActiveMQMessage(); } }
protected ActiveMQMessage createActiveMQMessage(Message message) throws JMSException { ActiveMQTextMessage answer = new ActiveMQTextMessage(); String text = ""; List<Object> list = message.getSubjectOrBodyOrThread(); for (Object object : list) { if (object instanceof Body) { Body body = (Body)object; text = body.getValue(); break; } } answer.setText(text); return answer; }
ActiveMQTextMessage text = new ActiveMQTextMessage(); try { text.setText(new String(command.getContent(), "UTF-8")); } catch (Throwable e) { throw new ProtocolException("Text could not bet set: " + e, false, e); ActiveMQTextMessage text = new ActiveMQTextMessage(); try { text.setText(new String(command.getContent(), "UTF-8")); } catch (Throwable e) { throw new ProtocolException("Text could not bet set: " + e, false, e);
ActiveMQTextMessage msg = new ActiveMQTextMessage(); msg.setConnection(connection); msg.setText(textMsg.getText()); activeMessage = msg; } else if (message instanceof BlobMessage) {
ActiveMQTextMessage msg = new ActiveMQTextMessage(); msg.setConnection(connection); msg.setText(textMsg.getText()); activeMessage = msg; } else if (message instanceof BlobMessage) {
ActiveMQTextMessage msg = new ActiveMQTextMessage(); msg.setConnection(connection); msg.setText(textMsg.getText()); activeMessage = msg; } else if (message instanceof BlobMessage) {