Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-2240

Camel ActiveMQComponent - Please add validation of unknown or invalid URI parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.2.0
    • 5.x
    • Broker
    • None

    Description

      AMQ is used a lot with Camel and vice-versa. In AMQ there is a activemq-camel.jar for easy AMQ-Camel integration.

      As Camel often uses URI for configuration we in Camel have validation for all parameters provided in the URI.
      But this is lacked in the activemq-camel.jar so you can provide bogus or misspelled options and AMQ just keeps on running.
      This is serious as it can be hard to overlook a tiny misspelled option and you think that it runs with this parameter, but it does not!

      This seems to only apply for "nested" URI options, eg the options prefixed with

      • jms
      • broker

      For instance using this factory method:

      org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent(String uri);
      

      In the sample code below, for a unit test, where I have mistyped some URI options by inserting XXX or the likes:

              ActiveMQComponent activemq = activeMQComponent("vm://localhost?broker.XXX=foo&broker.persistent=XXX&broker.useJmx=false&jms.redeliveryPolicy.maximumRedeliveries=0&jms.redeliveryPolicy.initialRedeliveryDelay=500&jms.useAsyncSend=false&jms.sendTimeout=ABC&jms.maxXXXXReconnectAttempts=1&jms.timeout=3000");
      

      But AMQ 5.2 is just started without any error indications

      2009-05-01 09:16:53,247 [main           ] INFO  BrokerService                  - ActiveMQ 5.2.0 JMS Message Broker (localhost) is starting
      2009-05-01 09:16:53,248 [main           ] INFO  BrokerService                  - For help or more information please see: http://activemq.apache.org/
      2009-05-01 09:16:53,392 [main           ] INFO  KahaStore                      - Kaha Store using data directory activemq-data/localhost/kr-store/data
      2009-05-01 09:16:53,513 [main           ] INFO  BrokerService                  - ActiveMQ JMS Message Broker (localhost, ID:davsclaus.local-50096-1241162213265-0:0) started
      2009-05-01 09:16:53,520 [main           ] INFO  TransportConnector             - Connector vm://localhost Started
      

      But if I enter an invalid URI without the prefix such as: bla=foo

              ActiveMQComponent activemq = activeMQComponent("vm://localhost?bla=foo");
      

      I get a nice error report

      org.apache.camel.RuntimeCamelException: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters: {bla=foo}
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: