Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(microservices): add kafka retriable exception, auto-unwrap payloads #9586

Merged
merged 12 commits into from
May 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/microservices/test/server/server-kafka.spec.ts
Original file line number Diff line number Diff line change
@@ -326,6 +326,28 @@ describe('ServerKafka', () => {
}
});

it('should call "handleEvent" if correlation identifier and reply topic are present but the handler is of type eventHandler', async () => {
const handler = sinon.spy();
(handler as any).isEventHandler = true;
(server as any).messageHandlers = objectToMap({
[topic]: handler,
});
const handleEventSpy = sinon.spy(server, 'handleEvent');
await server.handleMessage(payload);
expect(handleEventSpy.called).to.be.true;
});

it('should NOT call "handleEvent" if correlation identifier and reply topic are present but the handler is not of type eventHandler', async () => {
const handler = sinon.spy();
(handler as any).isEventHandler = false;
(server as any).messageHandlers = objectToMap({
[topic]: handler,
});
const handleEventSpy = sinon.spy(server, 'handleEvent');
await server.handleMessage(payload);
expect(handleEventSpy.called).to.be.false;
});

it(`should publish NO_MESSAGE_HANDLER if pattern not exists in messageHandlers object`, async () => {
await server.handleMessage(payload);
expect(
@@ -335,6 +357,7 @@ describe('ServerKafka', () => {
}),
).to.be.true;
});

it(`should call handler with expected arguments`, async () => {
const handler = sinon.spy();
(server as any).messageHandlers = objectToMap({
You are viewing a condensed version of this merge commit. You can view the full changes here.