You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by migurus <mi...@yahoo.com> on 2011/07/08 02:15:11 UTC

OpenWire C API problem with magic code

I run ActiveMQ 5.5.0 broker on Ubuntu, downloaded and compiled APR 1.4.5 and
C API related libactivmq and libopenwire. 

The test c supplied in Examples at:
http://svn.apache.org/repos/asf/activemq/sandbox/openwire-c/src/examples/

does not work for me, the issue is with the WireFormat magic code/version,
see debug lines from the log:

2011-07-07 15:35:30,324 | DEBUG | Sending: WireFormatInfo { version=7,
properties={CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false,
MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true,
MaxInactivityDuration=30000, TightEncodingEnabled=true,
StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]} |
org.apache.activemq.transport.WireFormatNegotiator | ActiveMQ Task-2
2011-07-07 15:35:30,327 | DEBUG | Using min of local: WireFormatInfo {
version=7, properties={CacheSize=1024, CacheEnabled=true,
SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000,
TcpNoDelayEnabled=true, MaxInactivityDuration=30000,
TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
and remote: WireFormatInfo { version=1297154048, properties={},
magic=[^A,^@,A,c,t,i,v,e]} | org.apache.activemq.transport.InactivityMonitor
| ActiveMQ Transport: tcp:///127.0.0.1:51606
2011-07-07 15:35:30,327 | DEBUG | Received WireFormat: WireFormatInfo {
version=1297154048, properties={}, magic=[^A,^@,A,c,t,i,v,e]} |
org.apache.activemq.transport.WireFormatNegotiator | ActiveMQ Transport:
tcp:///127.0.0.1:51606
2011-07-07 15:35:30,333 | DEBUG | tcp:///127.0.0.1:51606 before negotiation:
OpenWireFormat{version=7, cacheEnabled=false, stackTraceEnabled=false,
tightEncodingEnabled=false, sizePrefixDisabled=false} |
org.apache.activemq.transport.WireFormatNegotiator | ActiveMQ Transport:
tcp:///127.0.0.1:51606
2011-07-07 15:35:30,337 | DEBUG | Transport failed: java.io.IOException:
Remote wire format magic is invalid |
org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ
Transport: tcp:///127.0.0.1:51606

I debugged the client side and captured values sent to the broker, 15 bytes,
I will list them below:
1: '\001'
2: '\001'
3: '\000'
4: 'A'
5: 'c'
6: 't'
7: 'i'
8: 'v'
9: 'e'
10:'M'
11:'Q'
12:'\000'
13:'\000'
14:'\000'
15:'\002'
here last four bytes is version, which is set to 2 in libactivmq.


Somehow this message is shifted/misinterpreted by broker, so the magic token
and version are wrong.

One more piece of information: I compiled libopenwire using both supplied
versions ow_commands_v1.[ch] and ow_commands_v2.[ch], so I tried to link the
test with both, the result is the same with either version. Does anyone know
the reason for two versions? which one should I use?

Any help with fixing this will be much appreciated.

--
View this message in context: http://activemq.2283324.n4.nabble.com/OpenWire-C-API-problem-with-magic-code-tp3652948p3652948.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.