use of org.fusesource.stomp.codec.StompFrame in project camel by apache.
the class StompEndpoint method doStop.
@Override
protected void doStop() throws Exception {
connection.getDispatchQueue().execute(new Task() {
@Override
public void run() {
StompFrame frame = new StompFrame(DISCONNECT);
connection.send(frame, null);
}
});
connection.close(null);
}
use of org.fusesource.stomp.codec.StompFrame in project camel by apache.
the class StompConsumerTest method testConsume.
@Test
public void testConsume() throws Exception {
if (!canTest()) {
return;
}
context.addRoutes(createRouteBuilder());
context.start();
Stomp stomp = createStompClient();
final BlockingConnection producerConnection = stomp.connectBlocking();
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMinimumMessageCount(numberOfMessages);
for (int i = 0; i < numberOfMessages; i++) {
StompFrame frame = new StompFrame(SEND);
frame.addHeader(DESTINATION, StompFrame.encodeHeader("/queue/test"));
frame.addHeader(MESSAGE_ID, StompFrame.encodeHeader("msg:" + i));
frame.content(utf8("Important Message " + i));
producerConnection.send(frame);
}
mock.await(5, TimeUnit.SECONDS);
mock.assertIsSatisfied();
}
use of org.fusesource.stomp.codec.StompFrame in project camel by apache.
the class StompConsumerUriTest method testConsume.
@Test
public void testConsume() throws Exception {
if (!canTest()) {
return;
}
context.addRoutes(createRouteBuilder());
context.start();
Stomp stomp = createStompClient();
final BlockingConnection producerConnection = stomp.connectBlocking();
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMinimumMessageCount(numberOfMessages);
for (int i = 0; i < numberOfMessages; i++) {
StompFrame frame = new StompFrame(SEND);
frame.addHeader(DESTINATION, StompFrame.encodeHeader("/queue/test"));
frame.addHeader(MESSAGE_ID, StompFrame.encodeHeader("msg:" + i));
frame.content(utf8("Important Message " + i));
producerConnection.send(frame);
}
mock.await(5, TimeUnit.SECONDS);
mock.assertIsSatisfied();
}
Aggregations