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

MQTT endpoint misses QoS > 0 messages due to startup timing issue

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.14.0
    • 2.13.4, 2.14.1, 2.15.0
    • camel-mqtt
    • None
    • Unknown

    Description

      When the MQTT Endpoint is started the MQTT connection is immediately established, causing an immediate influx of persisted messages (put on the topic when the client was not available).

      Issue is that at this point, most likely no consumers are available yet to process these messages.

      Receiving a PUBLISH message

      Publish message are received without any consumers. Result : msg with QoS > 0 that were put on the topic while the client was not connected are never processed.

      Daemon Thread [hawtdispatch-DEFAULT-3] (Suspended (breakpoint at line 815 in CallbackConnection))	
      	CallbackConnection.toReceiver(PUBLISH) line: 815	
      	CallbackConnection.processFrame(MQTTFrame) line: 732	
      	CallbackConnection.access$1500(CallbackConnection, MQTTFrame) line: 51	
      	CallbackConnection$6.onTransportCommand(Object) line: 392	
      	TcpTransport.drainInbound() line: 709	
      	TcpTransport$6.run() line: 588	
      	NioDispatchSource$3.run() line: 209	
      	SerialDispatchQueue.run() line: 100	
      	SimpleThread.run() line: 77	
      

      No consumers registered yet

      Only when this finishes will Camel be able to process the messages.

      Daemon Thread [localhost-startStop-1] (Suspended (breakpoint at line 164 in MQTTEndpoint))	
      	owns: SpringCamelContext  (id=92)	
      	owns: Object  (id=143)	
      	owns: StandardContext  (id=144)	
      	MQTTEndpoint.addConsumer(MQTTConsumer) line: 164	
      	MQTTConsumer.doStart() line: 35	
      	MQTTConsumer(ServiceSupport).start() line: 61	
      	SpringCamelContext(DefaultCamelContext).startService(Service) line: 2158	
      	SpringCamelContext(DefaultCamelContext).doStartOrResumeRouteConsumers(Map<Integer,DefaultRouteStartupOrder>, boolean, boolean) line: 2452	
      	SpringCamelContext(DefaultCamelContext).doStartRouteConsumers(Map<Integer,DefaultRouteStartupOrder>, boolean) line: 2388	
      	SpringCamelContext(DefaultCamelContext).safelyStartRouteServices(boolean, boolean, boolean, boolean, Collection<RouteService>) line: 2318	
      	SpringCamelContext(DefaultCamelContext).doStartOrResumeRoutes(Map<String,RouteService>, boolean, boolean, boolean, boolean) line: 2091	
      	SpringCamelContext(DefaultCamelContext).doStartCamel() line: 1951	
      	SpringCamelContext(DefaultCamelContext).doStart() line: 1777	
      

      These messages will never be picked up.

      Perhaps it's more the responsibility of the consumer / producer to start a connection when they get attached to the endpoint ?

      Attachments

        Activity

          People

            njiang Willem Jiang
            davydewaele Davy De Waele
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: