asyncapi / java-spring-cloud-stream-template

Java Spring Cloud Stream template for the AsyncAPI Generator
31 stars 33 forks source link

Dispatcher has not subscribers when using reactive=true #334

Open Mrc0113 opened 1 year ago

Mrc0113 commented 1 year ago

Describe the bug

"Dispatcher has no subscribers" error when using the --reactive=true. This does not occur if using --reactive=false

How to Reproduce

Steps to reproduce the issue. Attach all resources that can help us understand the issue:

  1. Generate code: ag -o CustomerNotification -p binder=solace -p reactive=true -p artifactId=CustomerNotification -p groupId=CustomerNotification -p javaPackage=CustomerNotification -p host=tcp://localhost:55555 -p username=solace-cloud-client -p password=yourpassword -p msgVpn=yourvpn ./CustomerNotification-0.1.0.yaml @asyncapi/java-spring-cloud-stream-template using this asyncapi file:
    ---
    components:
    schemas:
    Flight Status:
      x-ep-schema-version: "0.1.0"
      x-ep-schema-version-id: "y7n5fn16lv6"
      x-ep-schema-state-name: "DRAFT"
      x-ep-schema-name: "Flight Status"
      type: "object"
      x-ep-application-domain-id: "rc80mv6avog"
      required:
      - "flightNumber"
      - "status"
      - "source"
      - "dest"
      x-ep-schema-version-displayname: ""
      x-ep-shared: "true"
      x-ep-application-domain-name: "Airline"
      x-ep-schema-state-id: "1"
      x-ep-schema-id: "28wqbhpc9x6"
      properties:
        source:
          type: "string"
        dest:
          type: "string"
        flightNumber:
          type: "string"
        status:
          type: "string"
    messages:
    Flight Delayed:
      x-ep-event-id: "gvr6k99vkx2"
      x-ep-event-version-displayname: ""
      description: ""
      x-ep-application-domain-id: "rc80mv6avog"
      schemaFormat: "application/vnd.aai.asyncapi+json;version=2.0.0"
      x-ep-event-state-name: "DRAFT"
      x-ep-shared: "true"
      x-ep-application-domain-name: "Airline"
      x-ep-event-version-id: "myoalnksnup"
      payload:
        $ref: "#/components/schemas/Flight Status"
      x-ep-event-version: "0.1.0"
      x-ep-event-name: "Flight Delayed"
      contentType: "application/json"
      x-ep-event-state-id: "1"
    channels:
    alaska/flight/{flight_num}/delayed:
    publish:
      bindings:
        solace:
          destinations:
          - destinationType: "queue"
            queue:
              name: "CUST_NOTIF"
              topicSubscriptions:
              - "alaska/flight/*/delayed"
          bindingVersion: "0.3.0"
      message:
        $ref: "#/components/messages/Flight Delayed"
    parameters:
      flight_num:
        schema:
          type: "string"
        x-ep-parameter-name: "flight_num"
    asyncapi: "2.5.0"
    info:
    x-ep-application-version: "0.1.0"
    x-ep-application-version-id: "ng7p4bv4zd2"
    x-ep-application-id: "9e75623ykba"
    x-ep-state-name: "DRAFT"
    title: "CustomerNotification"
    x-ep-application-domain-id: "rc80mv6avog"
    version: "0.1.0"
    x-ep-state-id: "1"
    x-ep-application-domain-name: "Airline"
  2. Start app mvnw spring-boot:run
  3. Publish message {"flightNumber":"ASA106","status":"delayed","source":"FAI","dest":"SEA"} using try-me
  4. You should see something similar to the error below:
    2023-04-25 14:21:49.207  WARN 740 --- [pool-4-thread-1] s.b.i.RetryableInboundXMLMessageListener : Failed to consume a message from destination #P2P/QTMP/v:developerproductionrk2ibwbcev9solaceprimary0/scst/an/00d826c8-771f-4f69-8e76-65f22e13d6c7/plain/alaska/flight/_/delayed - attempt 1
    2023-04-25 14:21:50.215  WARN 740 --- [pool-4-thread-1] s.b.i.RetryableInboundXMLMessageListener : Failed to consume a message from destination #P2P/QTMP/v:developerproductionrk2ibwbcev9solaceprimary0/scst/an/00d826c8-771f-4f69-8e76-65f22e13d6c7/plain/alaska/flight/_/delayed - attempt 2
    2023-04-25 14:21:52.230  WARN 740 --- [pool-4-thread-1] s.b.i.RetryableInboundXMLMessageListener : Failed to consume a message from destination #P2P/QTMP/v:developerproductionrk2ibwbcev9solaceprimary0/scst/an/00d826c8-771f-4f69-8e76-65f22e13d6c7/plain/alaska/flight/_/delayed - attempt 3
    2023-04-25 14:21:52.232 ERROR 740 --- [pool-4-thread-1] o.s.integration.handler.LoggingHandler   : org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for 
    channel 'application.alaskaFlightFlightNumDelayedConsumer-in-0'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers, failedMessage=GenericMessage [payload={"flightNumber":"ASA1132","status":"delayed","source":"KSEA","dest":"KSFO"}, headers={JMS_IBM_Character_Set=UTF-8, solace_destination=alaska/flight/flight-num/delayed, JMS_IBM_Encoding=546, jms_timestamp=1682450508330, JMS_IBM_PutApplType=28, target-protocol=kafka, JMS_IBM_Format=MQSTR   , skip-input-type-conversion=false, JMSXDeliveryCount=1, solace_discardIndication=false, solace_dmqEligible=true, solace_priority=4, JMS_IBM_PutTime=19214833, id=624148fd-7942-fc25-12bb-308e9eb6b1db, contentType=application/json, jms_expiration=0, jms_messageId=ID:414d5120514d312020202020202020206a16476401fc0040, timestamp=1682450509205, JMS_IBM_MsgType=8, solace_scst_messageVersion=1, solace_expiration=0, deliveryAttempt=3, JMSXUserID=mqm         , jms_priority=0, solace_timeToLive=0, JMSXAppID=MQ Explorer 9.3.0           , solace_receiveTimestamp=0, jms_redelivered=false, JMS_IBM_PutDate=20230425, acknowledgmentCallback=com.solace.spring.cloud.stream.binder.util.JCSMPAcknowledgementCallbackFactory$JCSMPAcknowledgementCallback@30cd1ab5, jms_deliveryMode=1, solace_redelivered=false}], failedMessage=GenericMessage [payload={"flightNumber":"ASA1132","status":"delayed","source":"KSEA","dest":"KSFO"}, headers={JMS_IBM_Character_Set=UTF-8, solace_destination=alaska/flight/flight-num/delayed, JMS_IBM_Encoding=546, jms_timestamp=1682450508330, JMS_IBM_PutApplType=28, target-protocol=kafka, JMS_IBM_Format=MQSTR   , skip-input-type-conversion=false, JMSXDeliveryCount=1, solace_discardIndication=false, solace_dmqEligible=true, solace_priority=4, JMS_IBM_PutTime=19214833, id=624148fd-7942-fc25-12bb-308e9eb6b1db, contentType=application/json, jms_expiration=0, jms_messageId=ID:414d5120514d312020202020202020206a16476401fc0040, timestamp=1682450509205, JMS_IBM_MsgType=8, solace_scst_messageVersion=1, solace_expiration=0, deliveryAttempt=3, JMSXUserID=mqm        
    , jms_priority=0, solace_timeToLive=0, JMSXAppID=MQ Explorer 9.3.0           , solace_receiveTimestamp=0, jms_redelivered=false, JMS_IBM_PutDate=20230425, acknowledgmentCallback=com.solace.spring.cloud.stream.binder.util.JCSMPAcknowledgementCallbackFactory$JCSMPAcknowledgementCallback@30cd1ab5, jms_deliveryMode=1, solace_redelivered=false}]
        at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:76)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:317)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:272)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166)

Expected behavior

A dispatcher should be found and the message should be successfully received :)