RabbitMq client still a Promise on App start up
See original GitHub issueDescribe the bug
Following the Marble docs for creating an amqp publisher I receive the following error on app start-up
(node:90349) UnhandledPromiseRejectionWarning: TypeError: rabbitMqClient.send is not a function
because the resolved rabbitMQ client is still a Promise even though it was eagerly bounded to the context
To Reproduce Amqp publisher
export const AmqpClientToken = createContextToken<MessagingClient>('MessagingClient');
export const amqpClient = messagingClient({
transport: Transport.AMQP,
options: {
host: 'amqp://localhost:5672',
queue: 'hello_queue'
},
});
Http effect
export const getRoot$ = r.pipe(
r.matchPath('/'),
r.matchType('GET'),
r.useEffect((req$, ctx) => {
const rabbitMqClient = useContext(AmqpClientToken)(ctx.ask);
return req$.pipe(
mergeMapTo(rabbitMqClient.send({ type: 'HELLO', payload: 'John' })),
mapTo({ status: HttpStatus.ACCEPTED }),
);
}),
);
App
const httpServerListener = httpListener({
middlewares: [
logger$({ silent: isTestEnv() }),
bodyParser$(),
],
effects: [
getRoot$
],
});
export const server = createServer({
port: getPortEnv(),
listener: httpServerListener,
dependencies: [
bindEagerlyTo(AmqpClientToken)(amqpClient),
],
});
export const main: IO.IO<void> = async () =>
await (await server)();
Expected behavior App starts up.
Desktop (please complete the following information):
- OS: Ubuntu
- Package + Version: Marble ^3.4.9
- Node version: 14.15.4
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Developers - RabbitMq client still a Promise on App start up -
Describe the bug. Following the Marble docs for creating an amqp publisher I receive the following error on app start-up
Read more >RabbitMQ tutorial - Work Queues
We have learned how to make sure that even if the consumer dies, the task isn't lost. But our tasks will still be...
Read more >Getting started with RabbitMQ in Spring Boot - Medium
App goes from dev environment to test environment, you need to create the queues. App goes to production, someone needs to create them....
Read more >How to make waiting for the completion of actions, then ...
What you want to have is usually accomplished with consumer acknowledgments. You can read about them here. In short, your consumer (in your ......
Read more >Subscriptions in Apollo Server - Apollo GraphQL Docs
To run both an Express app and a separate WebSocket server for subscriptions, ... Next, in order to set up both the HTTP...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@paulvitic any updates in this topic?
Unfortunately this issue seems stale. Anyways @JozefFlakus we tried to get Marble running with an RabbitMq and failed as well. We even checked out marble source code, ran “yarn” and “yarn build”. “yarn test:integration” does show that there might be a real problem with messaging since the tests are red. The script downloaded the latest “rabbitmq:management”. Maybe you can have a look?