-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
Expected Behavior
Publishing a large message that, for instance, has a base64 image string should trigger the subscriber.
Publisher
import { DaprClient, CommunicationProtocolEnum } from '@dapr/dapr';
import * as image from './image.js'
const client = new DaprClient({
communicationProtocol: CommunicationProtocolEnum.GRPC,
maxBodySizeMb: 10,
});
console.log("Publishing...")
setInterval(async () => {
await client.pubsub.publish("pubsub", "test", {
payload: image.data.image, //base64 image string
}, {
metadata:{
ttlInSeconds:"1"
}
});
console.log("published")
}, 3000);
Subscriber:
import { DaprServer, CommunicationProtocolEnum, DaprPubSubStatusEnum } from '@dapr/dapr';
const server = new DaprServer({
communicationProtocol: CommunicationProtocolEnum.GRPC,
clientOptions: {
communicationProtocol: CommunicationProtocolEnum.GRPC
}
});
const configs = await server.client.configuration.get("configuration", ["key"])
server.pubsub.subscribe("pubsub", "test", async (data, headers) => {
console.log("Subscriber received: " + JSON.stringify(data));
return DaprPubSubStatusEnum.SUCCESS;
}
);
await server.start();
command:
"scripts": {
"client": "dapr run --app-id checkout --dapr-http-port 3502 --app-protocol grpc --resources-path .dapr/components/ -- node client.js",
"server": "dapr run --app-id order-processing --app-port 5002 --dapr-http-port 3501 --app-protocol grpc --resources-path .dapr/components/ -- node server.js"
},
Redis PubSub Component Definition
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: pubsub
spec:
type: pubsub.redis
version: v1
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
Actual Behavior
Although the message get published to Redis stream the subscriber does not get triggered. In this test we are using a base64 image that is around 150kb.
If I just set the payload
to payload: ""
the subscriber gets triggered.
Steps to Reproduce the Problem
- Convert an image to a base64 string and pass the string into the
payload
on the publisher. - Execute both the client and the server npm scripts.
- Published messages should be on the redis stream named
test
. - Subscriber is not triggered.
- Stop both client and server.
- Update the
payload
to be emptypayload:""
- Execute both the client and the server npm scripts.
- Published messages should be on the redis stream named
test
. - Subscriber is triggered.
rzyns