activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Gomes (JIRA)" <>
Subject [jira] Commented: (AMQNET-204) ConnectionFactory for NETCF is always returning DEFAULT_BROKER_URL which is localhost
Date Wed, 04 Nov 2009 17:57:52 GMT


Jim Gomes commented on AMQNET-204:

The comment in the code indicates the reason for the #if/#else:

// Compact framework does not allow the activator ta pass parameters to a constructor.

This was added because it would not compile for .NET Compact Framework.  I just double-checked
MSDN, and seems to confirm that CF only supports the single constructor activator call.  However,
I'm not sure how this is an issue, because the very next line after the activator call, the
broker URI is set from a passed-in parameter.  This should accomplish the required functionality.
 Even though the object is initially created with the default broker URI of localhost, immediately
after creation, the URI should be set to what was passed in to the CreateConnectionFactory()

> ConnectionFactory for NETCF is always returning DEFAULT_BROKER_URL which is localhost
> -------------------------------------------------------------------------------------
>                 Key: AMQNET-204
>                 URL:
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>         Environment: Discovered when testing on a Windows CE device running CF2.0 - reproduced
in Visual Studio but using NETCF
>            Reporter: Jeff Smith
>            Assignee: Jim Gomes
> In NMSConnectionFactory.cs, there is # define for NETCF that is causing this line of
code to execute:
> connectionFactory = (IConnectionFactory) Activator.CreateInstance(factoryType);
> But that signature for CreateInstance does not take the parameters like the line in the
> object[] parameters = MakeParameterArray(uriProvider, constructorParams);
> connectionFactory = (IConnectionFactory) Activator.CreateInstance(factoryType, parameters);
> Because of that, the ConnectionFactory.cs class is returning the DEFAULT_BROKR_URL which
contains "localhost".  This is bad.  This is assuming that the broker is running on the mobile
device which is not our case.  We need our mobile devices to connect to a centralized message
> We removed the #if and let it run the version in the #else and it seems to work correctly
now without adverse effects but I did not study all the ramifications of removing this #if.
 Is the developer who put this in able to tell us why that was there?
> I see the #if in ConnectionFactory where you stop CF from doing the Environment call.
 I guess mobile devices do not have Environment variables?  But that #if doesn't matter in
our case.  The root cause of the problem is the fact that we need to call the right version
of CreateInstance that passes parameters.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message