on 11-27-2023 11:27 AM
Hi,
I want to emit and receive events from SAP Event Mesh in my CAP app. We have a dedicated queue for the topic where the events will be emitted to from the CAP app and a dedicated queue for the topic where I'll need to receive the events from.
My service definition:
service Service {
// Events @topic: 'a/b/c/triggered'
event triggered : { ID : UUID; parameters : { a : String(2); b: array of String(4); c : array of String(7) } } }
My service logic:
const messaging_receiving = await cds.connect.to("messaging-receiving");
const messaging_publishing = await cds.connect.to("messaging-publishing");
this.after("CREATE", "Runs", async (each) => {
const sA = "";
const aB = [];
const aC = [];
const oPayLoad = { ID: sInterfaceRunID, parameters: { a: sA, b: aB, c: aC, }, };
await messaging_publishing.emit( "a/b/c/triggered", oPayLoad ); } });
My cds.requires:
"cds": {
"requires" : {
"messaging-receiving": {
"kind": "enterprise-messaging-shared",
"publishPrefix": "$namespace/",
"subscribePrefix": "$namespace/",
"format": "cloudevents",
"queue": {
"name": "$namespace/v1/flowStatus"
}
},
"messaging-publishing": {
"kind": "enterprise-messaging-shared",
"publishPrefix": "$namespace/",
"subscribePrefix": "$namespace/",
"format": "cloudevents",
"queue": {
"name": "$namespace/v1/startFlow"
}
}
}
}<br>
The automatic creation of queues and topics is visible in the SAP Event Mesh. I'm able to receive events, but the ones I emit aren't showing up in the SAP Event Mesh. Any idea what I might be missing?
Kind regards,
Julian
We've fixed this issue by updaring @sap/cds from version 7.3.1. to version 7.4.1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi juliankuipers ,
CAP never emits events to a queue, hence the `queue` property for publish-only services is ignored.
CAP always emits to a topic. If a queue subscribes to this topic, it will be stored in that queue.
In your specific example, consumers must listen to topic "$namespace/a/b/c/triggered".
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi david.kunz2,
Thank you for your response.
We indeed want to emit to the topic "$namespace/a/b/c/triggered". In SAP Event Mesh we've got a queue subscribed to this topic.
When we only had one queue for both the emitting topic and the receiving topic, it worked. We saw in the logging of the CAP app that the event was emitted. Now, we do not even see the event get emitted, eventhough the code runs through the emit function.
Any idea where we might have taken a wrong turn with this approach?
Kind regards,
Julian
Hi juliankuipers ,
That's interesting, you should see the `emit` log:
[enterprise-messaging-amqp] - Emit { topic: '<yournamespace>/a/b/c/triggered' }
Ok, perfect, thanks for the feedback!
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.