You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Hiram Chirino (JIRA)" <ji...@apache.org> on 2006/05/22 16:55:51 UTC

[jira] Resolved: (AMQ-681) Tight encoding not the default; wire format negotiation needs work

     [ https://issues.apache.org/activemq/browse/AMQ-681?page=all ]
     
Hiram Chirino resolved AMQ-681:
-------------------------------

    Resolution: Won't Fix

There is no historical tight encoding since 4.0 is the first release where openwire gets used.  The wire negocation rule is, always start with loose encoding and version 1 of the protocol with all extra options off.

Loose encoding is much simpler to implement than the tight encoding.  That is way it was choosen to be the default.  With all the options off + loose encoding, it makes it much simpler to implement a simple openwire client.  The initial WireFormatInfo then allows the client to switch on any number of options incuding the tightEncoding.

> 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
>     Assignee: Hiram Chirino

>
>
> 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