Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18195

Add setExceptionListener(...) to SjmsComponent

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.18.0
    • camel-sjms
    • None
    • Unknown

    Description

      I'd like to set an exception listener for all topics using "sjms2" but SjmsComponent is missing a setExceptionListener(...) method
      https://github.com/apache/camel/blob/main/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
       
      You can see that the "jms" component has a setExceptionListener(...) method but I don't want spring-jms on my classpath
      https://github.com/apache/camel/blob/main/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java#L331-L333
       
      As a workaround I have the choice to:
      1. Set the exception listener in the URI of every jms inbound adapter
      eg: "sjms2:some-topic?exceptionListener=#myExceptionListener"
       
      2. Extend SjmsComponent2 to set the ExceptionListener on the Sjms2Component

      ExceptionListener myExceptionListener = ex -> handleException(ex);
      Sjms2Component jmsComponent = new  Sjms2Component() {
         protected SjmsEndpoint createSjmsEndpoint(String uri, String remaining) {
            SjmsEndpoint endpoint super.createSjmsEndpoint(uri, remaining);
            endpoint.setExceptionListener(exceptionListener);
            return endpoint;
         }
      }

       
      I'd like to request that setExceptionListener(...) be added to SjmsComponent (which will be inherited by Sjms2Component)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Lance Java Lance S
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: