use of org.fusesource.hawtdispatch.Task in project camel by apache.
the class StompEndpoint method send.
protected void send(final Exchange exchange, final AsyncCallback callback) {
final StompFrame frame = new StompFrame(SEND);
frame.addHeader(DESTINATION, StompFrame.encodeHeader(destination));
//Fix for CAMEL-9506 leveraging the camel converter to do the change
frame.content(utf8(exchange.getIn().getBody(String.class)));
connection.getDispatchQueue().execute(new Task() {
@Override
public void run() {
connection.send(frame, new Callback<Void>() {
@Override
public void onFailure(Throwable e) {
exchange.setException(e);
callback.done(false);
}
@Override
public void onSuccess(Void v) {
callback.done(false);
}
});
}
});
}
use of org.fusesource.hawtdispatch.Task 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);
}
Aggregations