You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Jeff Gillings (Created) (JIRA)" <ji...@apache.org> on 2011/12/13 21:31:35 UTC

[jira] [Created] (AMQ-3635) JmsTopicConnector checks for presence of localClientId then uses outboundClientId

JmsTopicConnector checks for presence of localClientId then uses outboundClientId
---------------------------------------------------------------------------------

                 Key: AMQ-3635
                 URL: https://issues.apache.org/jira/browse/AMQ-3635
             Project: ActiveMQ
          Issue Type: Bug
          Components: Connector
    Affects Versions: 5.4.2
         Environment: running 5.4.2 on linux.
            Reporter: Jeff Gillings
            Priority: Minor


On the JMS bridge topic connector, if I set the outboundClientId but not the localClientId, then the outbound client id will not be set.
This is because the JmsTopicConnector only sets the outboundClientId if the localClientId is set.  This appears to be a bug.

Here is 5.4.2 JmsTopicConnector.initializeForeignTopicConnection
    protected void initializeForeignTopicConnection() throws NamingException, JMSException {
        if (outboundTopicConnection == null) {
            // get the connection factories
            if (outboundTopicConnectionFactory == null) {
                // look it up from JNDI
                if (outboundTopicConnectionFactoryName != null) {
                    outboundTopicConnectionFactory = (TopicConnectionFactory)jndiOutboundTemplate
                        .lookup(outboundTopicConnectionFactoryName, TopicConnectionFactory.class);
                    if (outboundUsername != null) {
                        outboundTopicConnection = outboundTopicConnectionFactory
                            .createTopicConnection(outboundUsername, outboundPassword);
                    } else {
                        outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
                    }
                } else {
                    throw new JMSException("Cannot create localConnection - no information");
                }
            } else {
                if (outboundUsername != null) {
                    outboundTopicConnection = outboundTopicConnectionFactory
                        .createTopicConnection(outboundUsername, outboundPassword);
                } else {
                    outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
                }
            }
        }
>>>>    if (localClientId != null && localClientId.length() > 0) {           // CHECKS for existence of localClientId
            outboundTopicConnection.setClientID(getOutboundClientId());      // THEN uses outboundClientId
        }
        outboundTopicConnection.start();
    }

I'm thinking the above code should check for existence of outboundClientId instead of localClientId

Compare this to:
    protected void initializeLocalTopicConnection() throws NamingException, JMSException {
        if (localTopicConnection == null) {
            // get the connection factories
            if (localTopicConnectionFactory == null) {
                if (embeddedConnectionFactory == null) {
                    // look it up from JNDI
                    if (localConnectionFactoryName != null) {
                        localTopicConnectionFactory = (TopicConnectionFactory)jndiLocalTemplate
                            .lookup(localConnectionFactoryName, TopicConnectionFactory.class);
                        if (localUsername != null) {
                            localTopicConnection = localTopicConnectionFactory
                                .createTopicConnection(localUsername, localPassword);
                        } else {
                            localTopicConnection = localTopicConnectionFactory.createTopicConnection();
                        }
                    } else {
                        throw new JMSException("Cannot create localConnection - no information");
                    }
                } else {
                    localTopicConnection = embeddedConnectionFactory.createTopicConnection();
                }
            } else {
                if (localUsername != null) {
                    localTopicConnection = localTopicConnectionFactory.createTopicConnection(localUsername,
                                                                                             localPassword);
                } else {
                    localTopicConnection = localTopicConnectionFactory.createTopicConnection();
                }
            }
        }
>>>>        if (localClientId != null && localClientId.length() > 0) {    // CHECKS for existence of localClientId
            localTopicConnection.setClientID(getLocalClientId());         // THEN uses localClientId
        }
        localTopicConnection.start();
    }


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (AMQ-3635) JmsTopicConnector checks for presence of localClientId then uses outboundClientId

Posted by "Timothy Bish (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3635?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQ-3635.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 5.6.0

fixed in svn rev: 1238827
                
> JmsTopicConnector checks for presence of localClientId then uses outboundClientId
> ---------------------------------------------------------------------------------
>
>                 Key: AMQ-3635
>                 URL: https://issues.apache.org/jira/browse/AMQ-3635
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 5.4.2
>         Environment: running 5.4.2 on linux.
>            Reporter: Jeff Gillings
>            Assignee: Timothy Bish
>            Priority: Minor
>             Fix For: 5.6.0
>
>
> On the JMS bridge topic connector, if I set the outboundClientId but not the localClientId, then the outbound client id will not be set.
> This is because the JmsTopicConnector only sets the outboundClientId if the localClientId is set.  This appears to be a bug.
> Here is 5.4.2 JmsTopicConnector.initializeForeignTopicConnection
> {code}
>     protected void initializeForeignTopicConnection() throws NamingException, JMSException {
>         if (outboundTopicConnection == null) {
>             // get the connection factories
>             if (outboundTopicConnectionFactory == null) {
>                 // look it up from JNDI
>                 if (outboundTopicConnectionFactoryName != null) {
>                     outboundTopicConnectionFactory = (TopicConnectionFactory)jndiOutboundTemplate
>                         .lookup(outboundTopicConnectionFactoryName, TopicConnectionFactory.class);
>                     if (outboundUsername != null) {
>                         outboundTopicConnection = outboundTopicConnectionFactory
>                             .createTopicConnection(outboundUsername, outboundPassword);
>                     } else {
>                         outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
>                     }
>                 } else {
>                     throw new JMSException("Cannot create localConnection - no information");
>                 }
>             } else {
>                 if (outboundUsername != null) {
>                     outboundTopicConnection = outboundTopicConnectionFactory
>                         .createTopicConnection(outboundUsername, outboundPassword);
>                 } else {
>                     outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
>                 }
>             }
>         }
> >>>>    if (localClientId != null && localClientId.length() > 0) {           // CHECKS for existence of localClientId
>             outboundTopicConnection.setClientID(getOutboundClientId());      // THEN uses outboundClientId
>         }
>         outboundTopicConnection.start();
>     }
> {code}
> I'm thinking the above code should check for existence of outboundClientId instead of localClientId
> Compare this to:
> {code}
>     protected void initializeLocalTopicConnection() throws NamingException, JMSException {
>         if (localTopicConnection == null) {
>             // get the connection factories
>             if (localTopicConnectionFactory == null) {
>                 if (embeddedConnectionFactory == null) {
>                     // look it up from JNDI
>                     if (localConnectionFactoryName != null) {
>                         localTopicConnectionFactory = (TopicConnectionFactory)jndiLocalTemplate
>                             .lookup(localConnectionFactoryName, TopicConnectionFactory.class);
>                         if (localUsername != null) {
>                             localTopicConnection = localTopicConnectionFactory
>                                 .createTopicConnection(localUsername, localPassword);
>                         } else {
>                             localTopicConnection = localTopicConnectionFactory.createTopicConnection();
>                         }
>                     } else {
>                         throw new JMSException("Cannot create localConnection - no information");
>                     }
>                 } else {
>                     localTopicConnection = embeddedConnectionFactory.createTopicConnection();
>                 }
>             } else {
>                 if (localUsername != null) {
>                     localTopicConnection = localTopicConnectionFactory.createTopicConnection(localUsername,
>                                                                                              localPassword);
>                 } else {
>                     localTopicConnection = localTopicConnectionFactory.createTopicConnection();
>                 }
>             }
>         }
> >>>>        if (localClientId != null && localClientId.length() > 0) {    // CHECKS for existence of localClientId
>             localTopicConnection.setClientID(getLocalClientId());         // THEN uses localClientId
>         }
>         localTopicConnection.start();
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AMQ-3635) JmsTopicConnector checks for presence of localClientId then uses outboundClientId

Posted by "Timothy Bish (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192706#comment-13192706 ] 

Timothy Bish commented on AMQ-3635:
-----------------------------------

Looks like you might be right.  A good way forward is to create a unit test that validates the problem and submit a patch that corrects it.  
                
> JmsTopicConnector checks for presence of localClientId then uses outboundClientId
> ---------------------------------------------------------------------------------
>
>                 Key: AMQ-3635
>                 URL: https://issues.apache.org/jira/browse/AMQ-3635
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 5.4.2
>         Environment: running 5.4.2 on linux.
>            Reporter: Jeff Gillings
>            Priority: Minor
>
> On the JMS bridge topic connector, if I set the outboundClientId but not the localClientId, then the outbound client id will not be set.
> This is because the JmsTopicConnector only sets the outboundClientId if the localClientId is set.  This appears to be a bug.
> Here is 5.4.2 JmsTopicConnector.initializeForeignTopicConnection
> {code}
>     protected void initializeForeignTopicConnection() throws NamingException, JMSException {
>         if (outboundTopicConnection == null) {
>             // get the connection factories
>             if (outboundTopicConnectionFactory == null) {
>                 // look it up from JNDI
>                 if (outboundTopicConnectionFactoryName != null) {
>                     outboundTopicConnectionFactory = (TopicConnectionFactory)jndiOutboundTemplate
>                         .lookup(outboundTopicConnectionFactoryName, TopicConnectionFactory.class);
>                     if (outboundUsername != null) {
>                         outboundTopicConnection = outboundTopicConnectionFactory
>                             .createTopicConnection(outboundUsername, outboundPassword);
>                     } else {
>                         outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
>                     }
>                 } else {
>                     throw new JMSException("Cannot create localConnection - no information");
>                 }
>             } else {
>                 if (outboundUsername != null) {
>                     outboundTopicConnection = outboundTopicConnectionFactory
>                         .createTopicConnection(outboundUsername, outboundPassword);
>                 } else {
>                     outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
>                 }
>             }
>         }
> >>>>    if (localClientId != null && localClientId.length() > 0) {           // CHECKS for existence of localClientId
>             outboundTopicConnection.setClientID(getOutboundClientId());      // THEN uses outboundClientId
>         }
>         outboundTopicConnection.start();
>     }
> {code}
> I'm thinking the above code should check for existence of outboundClientId instead of localClientId
> Compare this to:
> {code}
>     protected void initializeLocalTopicConnection() throws NamingException, JMSException {
>         if (localTopicConnection == null) {
>             // get the connection factories
>             if (localTopicConnectionFactory == null) {
>                 if (embeddedConnectionFactory == null) {
>                     // look it up from JNDI
>                     if (localConnectionFactoryName != null) {
>                         localTopicConnectionFactory = (TopicConnectionFactory)jndiLocalTemplate
>                             .lookup(localConnectionFactoryName, TopicConnectionFactory.class);
>                         if (localUsername != null) {
>                             localTopicConnection = localTopicConnectionFactory
>                                 .createTopicConnection(localUsername, localPassword);
>                         } else {
>                             localTopicConnection = localTopicConnectionFactory.createTopicConnection();
>                         }
>                     } else {
>                         throw new JMSException("Cannot create localConnection - no information");
>                     }
>                 } else {
>                     localTopicConnection = embeddedConnectionFactory.createTopicConnection();
>                 }
>             } else {
>                 if (localUsername != null) {
>                     localTopicConnection = localTopicConnectionFactory.createTopicConnection(localUsername,
>                                                                                              localPassword);
>                 } else {
>                     localTopicConnection = localTopicConnectionFactory.createTopicConnection();
>                 }
>             }
>         }
> >>>>        if (localClientId != null && localClientId.length() > 0) {    // CHECKS for existence of localClientId
>             localTopicConnection.setClientID(getLocalClientId());         // THEN uses localClientId
>         }
>         localTopicConnection.start();
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (AMQ-3635) JmsTopicConnector checks for presence of localClientId then uses outboundClientId

Posted by "Timothy Bish (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3635?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish reassigned AMQ-3635:
---------------------------------

    Assignee: Timothy Bish
    
> JmsTopicConnector checks for presence of localClientId then uses outboundClientId
> ---------------------------------------------------------------------------------
>
>                 Key: AMQ-3635
>                 URL: https://issues.apache.org/jira/browse/AMQ-3635
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 5.4.2
>         Environment: running 5.4.2 on linux.
>            Reporter: Jeff Gillings
>            Assignee: Timothy Bish
>            Priority: Minor
>
> On the JMS bridge topic connector, if I set the outboundClientId but not the localClientId, then the outbound client id will not be set.
> This is because the JmsTopicConnector only sets the outboundClientId if the localClientId is set.  This appears to be a bug.
> Here is 5.4.2 JmsTopicConnector.initializeForeignTopicConnection
> {code}
>     protected void initializeForeignTopicConnection() throws NamingException, JMSException {
>         if (outboundTopicConnection == null) {
>             // get the connection factories
>             if (outboundTopicConnectionFactory == null) {
>                 // look it up from JNDI
>                 if (outboundTopicConnectionFactoryName != null) {
>                     outboundTopicConnectionFactory = (TopicConnectionFactory)jndiOutboundTemplate
>                         .lookup(outboundTopicConnectionFactoryName, TopicConnectionFactory.class);
>                     if (outboundUsername != null) {
>                         outboundTopicConnection = outboundTopicConnectionFactory
>                             .createTopicConnection(outboundUsername, outboundPassword);
>                     } else {
>                         outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
>                     }
>                 } else {
>                     throw new JMSException("Cannot create localConnection - no information");
>                 }
>             } else {
>                 if (outboundUsername != null) {
>                     outboundTopicConnection = outboundTopicConnectionFactory
>                         .createTopicConnection(outboundUsername, outboundPassword);
>                 } else {
>                     outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
>                 }
>             }
>         }
> >>>>    if (localClientId != null && localClientId.length() > 0) {           // CHECKS for existence of localClientId
>             outboundTopicConnection.setClientID(getOutboundClientId());      // THEN uses outboundClientId
>         }
>         outboundTopicConnection.start();
>     }
> {code}
> I'm thinking the above code should check for existence of outboundClientId instead of localClientId
> Compare this to:
> {code}
>     protected void initializeLocalTopicConnection() throws NamingException, JMSException {
>         if (localTopicConnection == null) {
>             // get the connection factories
>             if (localTopicConnectionFactory == null) {
>                 if (embeddedConnectionFactory == null) {
>                     // look it up from JNDI
>                     if (localConnectionFactoryName != null) {
>                         localTopicConnectionFactory = (TopicConnectionFactory)jndiLocalTemplate
>                             .lookup(localConnectionFactoryName, TopicConnectionFactory.class);
>                         if (localUsername != null) {
>                             localTopicConnection = localTopicConnectionFactory
>                                 .createTopicConnection(localUsername, localPassword);
>                         } else {
>                             localTopicConnection = localTopicConnectionFactory.createTopicConnection();
>                         }
>                     } else {
>                         throw new JMSException("Cannot create localConnection - no information");
>                     }
>                 } else {
>                     localTopicConnection = embeddedConnectionFactory.createTopicConnection();
>                 }
>             } else {
>                 if (localUsername != null) {
>                     localTopicConnection = localTopicConnectionFactory.createTopicConnection(localUsername,
>                                                                                              localPassword);
>                 } else {
>                     localTopicConnection = localTopicConnectionFactory.createTopicConnection();
>                 }
>             }
>         }
> >>>>        if (localClientId != null && localClientId.length() > 0) {    // CHECKS for existence of localClientId
>             localTopicConnection.setClientID(getLocalClientId());         // THEN uses localClientId
>         }
>         localTopicConnection.start();
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3635) JmsTopicConnector checks for presence of localClientId then uses outboundClientId

Posted by "Timothy Bish (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3635?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish updated AMQ-3635:
------------------------------

    Description: 
On the JMS bridge topic connector, if I set the outboundClientId but not the localClientId, then the outbound client id will not be set.
This is because the JmsTopicConnector only sets the outboundClientId if the localClientId is set.  This appears to be a bug.

Here is 5.4.2 JmsTopicConnector.initializeForeignTopicConnection

{code}
    protected void initializeForeignTopicConnection() throws NamingException, JMSException {
        if (outboundTopicConnection == null) {
            // get the connection factories
            if (outboundTopicConnectionFactory == null) {
                // look it up from JNDI
                if (outboundTopicConnectionFactoryName != null) {
                    outboundTopicConnectionFactory = (TopicConnectionFactory)jndiOutboundTemplate
                        .lookup(outboundTopicConnectionFactoryName, TopicConnectionFactory.class);
                    if (outboundUsername != null) {
                        outboundTopicConnection = outboundTopicConnectionFactory
                            .createTopicConnection(outboundUsername, outboundPassword);
                    } else {
                        outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
                    }
                } else {
                    throw new JMSException("Cannot create localConnection - no information");
                }
            } else {
                if (outboundUsername != null) {
                    outboundTopicConnection = outboundTopicConnectionFactory
                        .createTopicConnection(outboundUsername, outboundPassword);
                } else {
                    outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
                }
            }
        }
>>>>    if (localClientId != null && localClientId.length() > 0) {           // CHECKS for existence of localClientId
            outboundTopicConnection.setClientID(getOutboundClientId());      // THEN uses outboundClientId
        }
        outboundTopicConnection.start();
    }

{code}

I'm thinking the above code should check for existence of outboundClientId instead of localClientId

Compare this to:

{code}
    protected void initializeLocalTopicConnection() throws NamingException, JMSException {
        if (localTopicConnection == null) {
            // get the connection factories
            if (localTopicConnectionFactory == null) {
                if (embeddedConnectionFactory == null) {
                    // look it up from JNDI
                    if (localConnectionFactoryName != null) {
                        localTopicConnectionFactory = (TopicConnectionFactory)jndiLocalTemplate
                            .lookup(localConnectionFactoryName, TopicConnectionFactory.class);
                        if (localUsername != null) {
                            localTopicConnection = localTopicConnectionFactory
                                .createTopicConnection(localUsername, localPassword);
                        } else {
                            localTopicConnection = localTopicConnectionFactory.createTopicConnection();
                        }
                    } else {
                        throw new JMSException("Cannot create localConnection - no information");
                    }
                } else {
                    localTopicConnection = embeddedConnectionFactory.createTopicConnection();
                }
            } else {
                if (localUsername != null) {
                    localTopicConnection = localTopicConnectionFactory.createTopicConnection(localUsername,
                                                                                             localPassword);
                } else {
                    localTopicConnection = localTopicConnectionFactory.createTopicConnection();
                }
            }
        }
>>>>        if (localClientId != null && localClientId.length() > 0) {    // CHECKS for existence of localClientId
            localTopicConnection.setClientID(getLocalClientId());         // THEN uses localClientId
        }
        localTopicConnection.start();
    }

{code}

  was:
On the JMS bridge topic connector, if I set the outboundClientId but not the localClientId, then the outbound client id will not be set.
This is because the JmsTopicConnector only sets the outboundClientId if the localClientId is set.  This appears to be a bug.

Here is 5.4.2 JmsTopicConnector.initializeForeignTopicConnection
    protected void initializeForeignTopicConnection() throws NamingException, JMSException {
        if (outboundTopicConnection == null) {
            // get the connection factories
            if (outboundTopicConnectionFactory == null) {
                // look it up from JNDI
                if (outboundTopicConnectionFactoryName != null) {
                    outboundTopicConnectionFactory = (TopicConnectionFactory)jndiOutboundTemplate
                        .lookup(outboundTopicConnectionFactoryName, TopicConnectionFactory.class);
                    if (outboundUsername != null) {
                        outboundTopicConnection = outboundTopicConnectionFactory
                            .createTopicConnection(outboundUsername, outboundPassword);
                    } else {
                        outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
                    }
                } else {
                    throw new JMSException("Cannot create localConnection - no information");
                }
            } else {
                if (outboundUsername != null) {
                    outboundTopicConnection = outboundTopicConnectionFactory
                        .createTopicConnection(outboundUsername, outboundPassword);
                } else {
                    outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
                }
            }
        }
>>>>    if (localClientId != null && localClientId.length() > 0) {           // CHECKS for existence of localClientId
            outboundTopicConnection.setClientID(getOutboundClientId());      // THEN uses outboundClientId
        }
        outboundTopicConnection.start();
    }

I'm thinking the above code should check for existence of outboundClientId instead of localClientId

Compare this to:
    protected void initializeLocalTopicConnection() throws NamingException, JMSException {
        if (localTopicConnection == null) {
            // get the connection factories
            if (localTopicConnectionFactory == null) {
                if (embeddedConnectionFactory == null) {
                    // look it up from JNDI
                    if (localConnectionFactoryName != null) {
                        localTopicConnectionFactory = (TopicConnectionFactory)jndiLocalTemplate
                            .lookup(localConnectionFactoryName, TopicConnectionFactory.class);
                        if (localUsername != null) {
                            localTopicConnection = localTopicConnectionFactory
                                .createTopicConnection(localUsername, localPassword);
                        } else {
                            localTopicConnection = localTopicConnectionFactory.createTopicConnection();
                        }
                    } else {
                        throw new JMSException("Cannot create localConnection - no information");
                    }
                } else {
                    localTopicConnection = embeddedConnectionFactory.createTopicConnection();
                }
            } else {
                if (localUsername != null) {
                    localTopicConnection = localTopicConnectionFactory.createTopicConnection(localUsername,
                                                                                             localPassword);
                } else {
                    localTopicConnection = localTopicConnectionFactory.createTopicConnection();
                }
            }
        }
>>>>        if (localClientId != null && localClientId.length() > 0) {    // CHECKS for existence of localClientId
            localTopicConnection.setClientID(getLocalClientId());         // THEN uses localClientId
        }
        localTopicConnection.start();
    }


    
> JmsTopicConnector checks for presence of localClientId then uses outboundClientId
> ---------------------------------------------------------------------------------
>
>                 Key: AMQ-3635
>                 URL: https://issues.apache.org/jira/browse/AMQ-3635
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 5.4.2
>         Environment: running 5.4.2 on linux.
>            Reporter: Jeff Gillings
>            Priority: Minor
>
> On the JMS bridge topic connector, if I set the outboundClientId but not the localClientId, then the outbound client id will not be set.
> This is because the JmsTopicConnector only sets the outboundClientId if the localClientId is set.  This appears to be a bug.
> Here is 5.4.2 JmsTopicConnector.initializeForeignTopicConnection
> {code}
>     protected void initializeForeignTopicConnection() throws NamingException, JMSException {
>         if (outboundTopicConnection == null) {
>             // get the connection factories
>             if (outboundTopicConnectionFactory == null) {
>                 // look it up from JNDI
>                 if (outboundTopicConnectionFactoryName != null) {
>                     outboundTopicConnectionFactory = (TopicConnectionFactory)jndiOutboundTemplate
>                         .lookup(outboundTopicConnectionFactoryName, TopicConnectionFactory.class);
>                     if (outboundUsername != null) {
>                         outboundTopicConnection = outboundTopicConnectionFactory
>                             .createTopicConnection(outboundUsername, outboundPassword);
>                     } else {
>                         outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
>                     }
>                 } else {
>                     throw new JMSException("Cannot create localConnection - no information");
>                 }
>             } else {
>                 if (outboundUsername != null) {
>                     outboundTopicConnection = outboundTopicConnectionFactory
>                         .createTopicConnection(outboundUsername, outboundPassword);
>                 } else {
>                     outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
>                 }
>             }
>         }
> >>>>    if (localClientId != null && localClientId.length() > 0) {           // CHECKS for existence of localClientId
>             outboundTopicConnection.setClientID(getOutboundClientId());      // THEN uses outboundClientId
>         }
>         outboundTopicConnection.start();
>     }
> {code}
> I'm thinking the above code should check for existence of outboundClientId instead of localClientId
> Compare this to:
> {code}
>     protected void initializeLocalTopicConnection() throws NamingException, JMSException {
>         if (localTopicConnection == null) {
>             // get the connection factories
>             if (localTopicConnectionFactory == null) {
>                 if (embeddedConnectionFactory == null) {
>                     // look it up from JNDI
>                     if (localConnectionFactoryName != null) {
>                         localTopicConnectionFactory = (TopicConnectionFactory)jndiLocalTemplate
>                             .lookup(localConnectionFactoryName, TopicConnectionFactory.class);
>                         if (localUsername != null) {
>                             localTopicConnection = localTopicConnectionFactory
>                                 .createTopicConnection(localUsername, localPassword);
>                         } else {
>                             localTopicConnection = localTopicConnectionFactory.createTopicConnection();
>                         }
>                     } else {
>                         throw new JMSException("Cannot create localConnection - no information");
>                     }
>                 } else {
>                     localTopicConnection = embeddedConnectionFactory.createTopicConnection();
>                 }
>             } else {
>                 if (localUsername != null) {
>                     localTopicConnection = localTopicConnectionFactory.createTopicConnection(localUsername,
>                                                                                              localPassword);
>                 } else {
>                     localTopicConnection = localTopicConnectionFactory.createTopicConnection();
>                 }
>             }
>         }
> >>>>        if (localClientId != null && localClientId.length() > 0) {    // CHECKS for existence of localClientId
>             localTopicConnection.setClientID(getLocalClientId());         // THEN uses localClientId
>         }
>         localTopicConnection.start();
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira