Skip to Content
0
Jan 05, 2023 at 08:37 PM

CAP Node.js: Enterprise Messaging (SAP event mesh) with service instances > 1

553 Views

I tried to create a service that is configured for enterprise messaging, but is load balanced over 3 instances.

My module configuration looks as follows

...  
- name: msgexamples-srv
    type: nodejs
    path: gen/srv
    parameters:
      buildpack: nodejs_buildpack
      instances: 3
      memory: 512M
...

my cds section in package.json is pretty straightforward...

  "cds": {
    "requires": {
      "messaging": {
        "kind": "file-based-messaging",
        "file": "~/tmp/cds-msgexamples-msg-box"
      },
      "[production]": {
        "messaging": {
          "kind": "enterprise-messaging-shared",
          "format": "cloudevents",
          "publishPrefix": "$namespace/",
          "subscribePrefix": "$namespace/"
        },
        "auth": {
          "kind": "xsuaa"
        }
      }
    }
  }

.. but when I try to deploy my service it bombs in the logs as it seems it is trying to delete and create the queue and webhooks 3 different times. That in itself would not be the worst, but the webhook is in a state where the handshake status in event mesh is 'Failed' and even triggering a handshake does not seem to work.

As a result I can send events from my CAP service to the queue and they show up properly, but do not receive anything back.

I assume the only way around this is to use 'enterprise-messaging-shared'?