activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Smith (JIRA)" <jira+amq...@apache.org>
Subject [jira] Commented: (AMQNET-204) ConnectionFactory for NETCF is always returning DEFAULT_BROKER_URL which is localhost
Date Wed, 04 Nov 2009 22:41:54 GMT

    [ https://issues.apache.org/activemq/browse/AMQNET-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=55167#action_55167
] 

Jeff Smith commented on AMQNET-204:
-----------------------------------

Ok - I see what you are saying.  I thought I had my project setup to use CF-2.0 but apparently
I wasn't, so that is why the activator wasn't complaining.

If I need to take this to a forum, let me know - but - the behavior I am trying to troubleshoot
is when running on my mobile device with CF, I am using the sample code to connect to a message
queue on a remote machine.  When I get to the line:

  using (ISession session = connection.CreateSession())

I end up in a couple of threads that appear to be looping non-stop (or maybe to some max interation
that I am too impatient to wait for).  The main thread is in FailoverTransport.cs down in
the Oneway method. 

The other thread is in the doConnect() method.  It is in this method where I can inspect the
connectList and see a URI that is tcp://localhost:61616 - which is not correct.  I had specified
my URI in my original code to be:

Uri connecturi = new Uri("activemq:tcp://N274105:61616");
// NOTE: ensure the nmsprovider-activemq.config file exists in the executable folder.
IConnectionFactory factory = new NMSConnectionFactory(connecturi);
using (IConnection connection = factory.CreateConnection())
using (ISession session = connection.CreateSession())

So something is forcing a "localhost" in there and not honoring my URI hostname of N274105.
 I will continue to examine the #if's and see how the DEFAULT_BROKER_URL value is being put
in there instead of the one I am specifying.

> ConnectionFactory for NETCF is always returning DEFAULT_BROKER_URL which is localhost
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-204
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-204
>             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
#else:
> 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
broker.  
> 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.


Mime
View raw message