Tight encoding not the default; wire format negotiation needs work
------------------------------------------------------------------
Key: AMQ-681
URL: https://issues.apache.org/activemq/browse/AMQ-681
Project: ActiveMQ
Type: Bug
Components: Broker
Reporter: Andrew Lusk
In OpenWireFormat.java, tightEncoding defaults to false, when, since it's the
historical format, it should be true.
Wire format negotiation isn't really negotiation. Since the broker defaults to
loose encoding, it sends a loosely-encoded WireFormatInfo message to connecting
clients, and expects loosely-encoded WireFormatInfo messages from them. This
not only enforces that clients implement loose marshalling and unmarshalling,
but fails when the client sends a well-formatted but tightly-encoded
WireFormatInfo message.
The broker fails in this case because it assumes that the client and broker
both have the same concept of what encoding is the default, when in actuality
the encoding of a message should be part of the actual message, allowing the
broker to handle clients who prefer either format (and may not have the other
format even implemented).
The broker should also only ever send messages in the format asked for by the
client - it should wait to send a WireFormatInfo until it has received one from
the client indicating its preferred format.
I suggest two changes:
* adding a leading byte to all messages indicating their encoding
* the broker should wait to send a WireFormatInfo until it has received one
from the connecting client, whose preferences override all broker defaults for
that connection
The requirement that the server and client have shared, non-obvious information
from the beginning (like which encoding is default) causes ugly problem in the
broker like this, when it gets a message of a type it didn't expect:
Exception in thread "tcp:///127.0.0.1:54316"
java.lang.IllegalArgumentException: Invalid version: 1297154048, could not load
org.apache.activemq.openwire.v1297154048.MarshallerFactory
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira