You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Adam Sussman (JIRA)" <ji...@apache.org> on 2011/02/16 04:36:57 UTC

[jira] Updated: (AMQCPP-351) Using incorrect peer list in failover transport

     [ https://issues.apache.org/jira/browse/AMQCPP-351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Sussman updated AMQCPP-351:
--------------------------------

    Patch Info: [Patch Available]

> Using incorrect peer list in failover transport
> -----------------------------------------------
>
>                 Key: AMQCPP-351
>                 URL: https://issues.apache.org/jira/browse/AMQCPP-351
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 3.2.4
>            Reporter: Adam Sussman
>            Assignee: Timothy Bish
>         Attachments: amqcpp-351.patch
>
>
> In the failover transport, the broker hands the client a list of known peer brokers the client can attempt upon connection failure.  In the Java client libs, this list of peers is obtained from the ConnectionControl object and that list is subject to various configuration controls on the broker.  The C++ client gets its list from the BrokerInfo object who's list is NOT controlled at all by broker settings and which also retains query string artifacts that should not be used (see AMQ-3124).
> The list of peers the C++ client is using is not correct and not under the same controls as the list the Java client is using. The C++ failover transport should be altered to use the same source of peer data as the Java client, the ConnectionControl object.
> In currently released versions (3.2.4 and older), the entire reconnect list comes from BrokerInfo.getPeerBrokerInfos.  In trunk, the list comes from BrokerInfo.getPeerBrokerInfos PLUS ConnectionControl.getReconnectTo.  However, the Java client gets its list from ConnectionControl.getConnectedBrokers plus ConnectionControl.getReconnectTo and does not use BrokerInfo at all.
> At a minimum, the usage of BrokerInfo.getPeerBrokerInfos needs to be removed in FailoverTransportListener.cpp and usage of getConnectedBrokers needs to be added to FailoverTransport.cpp:handleConnectionControl.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: sending ObjectMessage between C# and Java

Posted by Jim Gomes <e....@gmail.com>.
The NMS API has some good support for automatically serializing C# objects
into XML format and back out into objects.  You can refer to the
XmlMessageTest.cs unit test in the Apache.NMS project for some sample code
on how to go about this.

If you are using the .NET 3.5 assemblies (or later version, or Mono), then
there are several extension methods that make the syntax very nice.  The
XmlMessageTest.cs file shows two examples -- one using extension methods
(the preferred way), and one without, for .NET 2.0 and earlier.

I use these functions heavily to pass objects back and forth between C# and
Java.

On Wed, Feb 16, 2011 at 6:27 AM, Adam Kaminiecki <ad...@dgt.com.pl> wrote:

> Hi.
>
> You are right. After investigation a can tell you now and Im SURE Its
> impossible to send ObjectMessage between clients (C# is not able to get body
> from this type of message in Java it is possible after workaround :) ). Only
> solution is serialize object to XML and then send it as TextMessage. Thats
> work fine!
>
>
> Regards,
> Adam
>
>
>
> W dniu 2011-02-16 12:49, Timothy Bish pisze:
>
>  On Wed, 2011-02-16 at 11:31 +0100, Adam Kaminiecki wrote:
>>
>>> Hi,
>>>
>>> Can anybody tell me how to get body form ObjectMessage in C#  or
>>> properly send from Java??
>>> Everything work ok for TextMessage but when I send  text message from
>>> Java in ObectMessage in C# client occur an error
>>>
>>> where IMessage m
>>> ((IObjectMessage) m).Body = '((IObjectMessage) m).Body' threw an
>>> exception of type 'System.Runtime.Serialization.SerializationException'
>>>
>>> System.SystemException {base} = {"input stream is not a valid binary
>>> format. The content of the initial (in bytes):.......
>>>
>>>
>>> But when I send From C# it is ok.
>>>
>>>  C# cannot de-serialize a java Object, it doesn't know anything about the
>> byte java types or how they are encoded.  You can send C# objects to C#
>> clients if they know about the type you are sending but that's the limit
>> of what you can do with ObjectMessage in C#.
>>
>> If you really need to send objects then you should look into using
>> something like XStream to convert them to XML and then parse the XML on
>> the C# side.
>>
>> Regards
>>
>>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>

Re: sending ObjectMessage between C# and Java

Posted by Adam Kaminiecki <ad...@dgt.com.pl>.
Hi.

You are right. After investigation a can tell you now and Im SURE Its 
impossible to send ObjectMessage between clients (C# is not able to get 
body from this type of message in Java it is possible after workaround 
:) ). Only solution is serialize object to XML and then send it as 
TextMessage. Thats work fine!


Regards,
Adam



W dniu 2011-02-16 12:49, Timothy Bish pisze:
> On Wed, 2011-02-16 at 11:31 +0100, Adam Kaminiecki wrote:
>> Hi,
>>
>> Can anybody tell me how to get body form ObjectMessage in C#  or
>> properly send from Java??
>> Everything work ok for TextMessage but when I send  text message from
>> Java in ObectMessage in C# client occur an error
>>
>> where IMessage m
>> ((IObjectMessage) m).Body = '((IObjectMessage) m).Body' threw an
>> exception of type 'System.Runtime.Serialization.SerializationException'
>>
>> System.SystemException {base} = {"input stream is not a valid binary
>> format. The content of the initial (in bytes):.......
>>
>>
>> But when I send From C# it is ok.
>>
> C# cannot de-serialize a java Object, it doesn't know anything about the
> byte java types or how they are encoded.  You can send C# objects to C#
> clients if they know about the type you are sending but that's the limit
> of what you can do with ObjectMessage in C#.
>
> If you really need to send objects then you should look into using
> something like XStream to convert them to XML and then parse the XML on
> the C# side.
>
> Regards
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


Re: sending ObjectMessage between C# and Java

Posted by Timothy Bish <ta...@gmail.com>.
On Wed, 2011-02-16 at 11:31 +0100, Adam Kaminiecki wrote:
> Hi,
> 
> Can anybody tell me how to get body form ObjectMessage in C#  or 
> properly send from Java??
> Everything work ok for TextMessage but when I send  text message from 
> Java in ObectMessage in C# client occur an error
> 
> where IMessage m
> ((IObjectMessage) m).Body = '((IObjectMessage) m).Body' threw an 
> exception of type 'System.Runtime.Serialization.SerializationException'
> 
> System.SystemException {base} = {"input stream is not a valid binary 
> format. The content of the initial (in bytes):.......
> 
> 
> But when I send From C# it is ok.
> 

C# cannot de-serialize a java Object, it doesn't know anything about the
byte java types or how they are encoded.  You can send C# objects to C#
clients if they know about the type you are sending but that's the limit
of what you can do with ObjectMessage in C#.

If you really need to send objects then you should look into using
something like XStream to convert them to XML and then parse the XML on
the C# side.

Regards

-- 
Tim Bish
------------
FuseSource
Email: tim.bish@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/



sending ObjectMessage between C# and Java

Posted by Adam Kaminiecki <ad...@dgt.com.pl>.
Hi,

Can anybody tell me how to get body form ObjectMessage in C#  or 
properly send from Java??
Everything work ok for TextMessage but when I send  text message from 
Java in ObectMessage in C# client occur an error

where IMessage m
((IObjectMessage) m).Body = '((IObjectMessage) m).Body' threw an 
exception of type 'System.Runtime.Serialization.SerializationException'

System.SystemException {base} = {"input stream is not a valid binary 
format. The content of the initial (in bytes):.......


But when I send From C# it is ok.


Any ideas how can I fix my problem??


Best regards,
Adam

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.