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

Add more than one event listener to consumers #5

Merged
merged 1 commit into from
Dec 22, 2020

Conversation

hdiaz-nectia
Copy link
Contributor

Events from sqs-consumer:

"Each consumer is an EventEmitter and emits the following events:
processing_error, timeout_error, message_received, message_processed, response_processed, stopped, empty"

https://github.com/BBC/sqs-consumer#events

processing_error, timeout_error, message_received, message_processed, response_processed, stopped, empty
@ssut ssut merged commit 2ede8f7 into ssut:master Dec 22, 2020
hdiaz-nectia added a commit to hdiaz-nectia/nestjs-sqs that referenced this pull request Dec 22, 2020
fix: Add more than one event listener to consumers, such as: (ssut#5)
@hdiaz-nectia
Copy link
Contributor Author

hdiaz-nectia commented Dec 22, 2020

Hi,

I've noticed that the github actions failed in test, when I run test:e2e locally using the same docker image s12v/elasticmq all test failed because AWS.SimpleQueueService.NonExistentQueue.

Reading documentation from softwaremill/elasticmq says, "While creating the FIFO queue, .fifo suffix will be added automatically to queue name.", so I change the file module.e2e-spec.ts like that:

const TestQueues: { [key in TestQueue]: SqsConsumerOptions | SqsProducerOptions } = {
  [TestQueue.Test]: {
    name: TestQueue.Test,
    queueUrl: `${SQS_ENDPOINT}/queue/test.fifo`,
    sqs,
  },
  [TestQueue.DLQ]: {
    name: TestQueue.DLQ,
    queueUrl: `${SQS_ENDPOINT}/queue/test-dead.fifo`,
    sqs,
  },
};

Now it passed all test except the last one:

    it('should consume a dead letter from DLQ', async () => {
      jest.setTimeout(10000);

      await waitForExpect(() => {
        expect(fakeDLQProcessor.mock.calls.length).toBe(1);
      }, 9900, 500);
    });

Error details:

Timeout - Async callback was not invoked within the 10000 ms timeout specified by jest.setTimeout.Timeout

Can you help me ?

@hdiaz-nectia hdiaz-nectia deleted the hotfix/fix-consumer-lists-events branch December 23, 2020 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants