make the protocol tracing configurable.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1409417 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2012-11-14 21:27:27 +00:00
parent dd0b16d38b
commit cf70ce97ee
1 changed files with 13 additions and 11 deletions

View File

@ -85,24 +85,26 @@ class AmqpProtocolConverter {
// private String clientId;
// private final String QOS_PROPERTY_NAME = "QoSPropertyName";
int prefetch = 100;
boolean trace = false;
TransportImpl protonTransport = new TransportImpl();
ConnectionImpl protonConnection = new ConnectionImpl();
{
this.protonTransport.bind(this.protonConnection);
this.protonTransport.setProtocolTracer(new ProtocolTracer() {
@Override
public void receivedFrame(TransportFrame transportFrame) {
System.out.println(String.format("%s | RECV: %s", amqpTransport.getRemoteAddress(), transportFrame.getBody()));
}
@Override
public void sentFrame(TransportFrame transportFrame) {
System.out.println(String.format("%s | SENT: %s", amqpTransport.getRemoteAddress(), transportFrame.getBody()));
}
});
if( trace ) {
this.protonTransport.setProtocolTracer(new ProtocolTracer() {
@Override
public void receivedFrame(TransportFrame transportFrame) {
System.out.println(String.format("%s | RECV: %s", amqpTransport.getRemoteAddress(), transportFrame.getBody()));
}
@Override
public void sentFrame(TransportFrame transportFrame) {
System.out.println(String.format("%s | SENT: %s", amqpTransport.getRemoteAddress(), transportFrame.getBody()));
}
});
}
}
void pumpProtonToSocket() {