Spaces in Topic Names

View: New views
10 Messages — Rating Filter:   Alert me  

Spaces in Topic Names

by Mark Baker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Again -

I need to connect to some topics on a Weblogic 10 server.  Here's the problem, the topic names have spaces in them.  In my config file, I specify jms:// My Topic and I get an error stating that jms:// My%20Topic was not found in the JNDI lookup.

I don't have any control over the topic names on the remote server.  Any suggestions?  BTW, I also tried putting in a   and I got parse error at startup.

Thanks - Mark

Re: Spaces in Topic Names

by Mark Baker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 BTW - I used the UTF-8 version of space (# 32;) and got the same problem.  Mule just changes the spaces to %20.

Does anyone have a workaround for this?

Thanks - Mark

Re: Spaces in Topic Names

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is a very odd naming scheme. I'd find out what Weblogic recommends doing with such names and use the same escape char in Mule.

HTH,
Andrew

On Mon, Nov 9, 2009 at 2:11 PM, Mark Baker <mark.a.baker@...> wrote:

 BTW - I used the UTF-8 version of space (# 32;) and got the same problem.
Mule just changes the spaces to %20.

Does anyone have a workaround for this?

Thanks - Mark

--
View this message in context: http://old.nabble.com/Spaces-in-Topic-Names-tp26230897p26271991.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Spaces in Topic Names

by Mark Baker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


You're right, this is an odd naming scheme, but I'm just connecting to another server an I have no control over their topic names.

More generally, isn't this a bug in Mule?  The JNDI interface takes a String (or Name) for the lookup method, not an URI.  So isn't this really a problem with how Mule is doing the lookup?

Mark

Re: Spaces in Topic Names

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mule will pass destination name as is, however every broker may have special handling for non-alphadigits (e.g. dot is typically a special one). Did you look it up ok from a standalone test?

Andrew

On Tue, Nov 10, 2009 at 12:48 PM, Mark Baker <mark.a.baker@...> wrote:


You're right, this is an odd naming scheme, but I'm just connecting to
another server an I have no control over their topic names.

More generally, isn't this a bug in Mule?  The JNDI interface takes a String
(or Name) for the lookup method, not an URI.  So isn't this really a problem
with how Mule is doing the lookup?

Mark

--
View this message in context: http://old.nabble.com/Spaces-in-Topic-Names-tp26230897p26287349.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Spaces in Topic Names

by Mark Baker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Andrew -

I am able to look it up from a standalone (non Mule) test.  I just use the topic name with the spaces and it works fine.

I've dug into the code and here's where I believe the problem is:

In Jms11Support.java:

    public Destination createDestination(Session session, ImmutableEndpoint endpoint) throws JMSException
    {
        String address = endpoint.getEndpointURI().toString();

........

So you're using the endpoint URI for the address.  Then, in the MuleEndpointURI constructor:

    public MuleEndpointURI(String uri) throws EndpointException
    {
        uri = uri.trim().replaceAll(" ", "%20");
        //Allow Expressions to be embedded
        uri = uri.replaceAll("\\{", "\\[");
        uri = uri.replaceAll("\\}", "\\]");

.......

In the first line, you replace all spaces with %20.

So in my case, my "jms://my Topic" endpoint gets turned into the "jms://my%20Topic" URI by the MuleEndpointURI constructor.  Then the Jms11Support code uses the exact String "my%20Topic" for the JNDI lookup, which correctly fails on the Weblogic server.

Thanks - Mark


Re: Spaces in Topic Names

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As a quick workaround you can override the connector to return a custom support subclass 'undoing' the conversion.

HTH,
Andrew

On Tue, Nov 10, 2009 at 3:56 PM, Mark Baker <mark.a.baker@...> wrote:

Hi Andrew -

I am able to look it up from a standalone (non Mule) test.  I just use the
topic name with the spaces and it works fine.

I've dug into the code and here's where I believe the problem is:

In Jms11Support.java:

   public Destination createDestination(Session session, ImmutableEndpoint
endpoint) throws JMSException
   {
       String address = endpoint.getEndpointURI().toString();
........

So you're using the endpoint URI for the address.  Then, in the
MuleEndpointURI constructor:

   public MuleEndpointURI(String uri) throws EndpointException
   {
       uri = uri.trim().replaceAll(" ", "%20");
       //Allow Expressions to be embedded
       uri = uri.replaceAll("\\{", "\\[");
       uri = uri.replaceAll("\\}", "\\]");
.......

In the first line, you replace all spaces with %20.

So in my case, my "jms://my Topic" endpoint gets turned into the
"jms://my%20Topic" URI by the MuleEndpointURI constructor.  Then the
Jms11Support code uses the exact String "my%20Topic" for the JNDI lookup,
which correctly fails on the Weblogic server.

Thanks - Mark


--
View this message in context: http://old.nabble.com/Spaces-in-Topic-Names-tp26230897p26289562.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Spaces in Topic Names

by Mark Baker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for that idea.  I was trying not to alter the source for the workaround so the custom connector / custom JmsSupport classes should work well.

Thanks again - Mark

Re: Spaces in Topic Names

by Daniel Zapata-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark,

It would be great to also capture this in a Jira issue, so a fix can be considered for a future release: http://www.mulesoft.org/jira  Bonus points for attaching a test case :-)

On Tue, Nov 10, 2009 at 2:04 PM, Mark Baker <mark.a.baker@...> wrote:

Thanks for that idea.  I was trying not to alter the source for the
workaround so the custom connector / custom JmsSupport classes should work
well.

Thanks again - Mark

--
View this message in context: http://old.nabble.com/Spaces-in-Topic-Names-tp26230897p26292096.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Spaces in Topic Names

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Don't treat it as modifying. Mule has been created from the grounds up to be extendable and tweakable, so here you go.

HTH,
Andrew