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

First implementation #1

Merged
merged 15 commits into from
Apr 22, 2024
Merged

First implementation #1

merged 15 commits into from
Apr 22, 2024

Conversation

marcopiraccini
Copy link
Contributor

@marcopiraccini marcopiraccini commented Apr 12, 2024

First implementation.
This is configured with:

{
    url: 'amqp://localhost',
    generateExchange: true,
    exchanges: [{
       name: 'test-exchange',
       targetUrl: 'http://localhost:3042/target'
   }]
}

Signed-off-by: marcopiraccini <[email protected]>
Signed-off-by: marcopiraccini <[email protected]>
@marcopiraccini marcopiraccini requested a review from mcollina April 12, 2024 13:52
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also expose routes to publish messages on those exchanges

lib/schema.js Show resolved Hide resolved
lib/plugin.js Outdated Show resolved Hide resolved
lib/schema.js Outdated Show resolved Hide resolved
@marcopiraccini marcopiraccini changed the title First implementation First implementation [WIP] Apr 17, 2024
@marcopiraccini marcopiraccini marked this pull request as ready for review April 18, 2024 13:03
@marcopiraccini marcopiraccini changed the title First implementation [WIP] First implementation Apr 18, 2024
lib/plugin.js Outdated Show resolved Hide resolved
lib/plugin.js Outdated Show resolved Hide resolved
lib/plugin.js Outdated Show resolved Hide resolved
lib/rabbitmq.js Show resolved Hide resolved
lib/rabbitmq.js Outdated Show resolved Hide resolved
lib/rabbitmq.js Outdated Show resolved Hide resolved
lib/rabbitmq.js Outdated Show resolved Hide resolved
lib/rabbitmq.js Outdated Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test with two instances listening to the same exchange and queue? They should deliver the message only once.

method: 'POST',
headers: targetHeaders,
body: JSON.stringify({ message })
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you must consume the incoming body, or you'd wait for the socket to timeout to close it.

})

app.post('/publish/:exchange/:routingKey?', {
schema: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also add a schema for the output?


const targetHeaders = headers || {}
if (!targetHeaders['Content-Type'] && !targetHeaders['content-type']) {
targetHeaders['Content-Type'] = 'application/json'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is missing the charset. Unfortunately it's needed or it won't work for folks in asia.

@marcopiraccini
Copy link
Contributor Author

Could you add a test with two instances listening to the same exchange and queue? They should deliver the message only once.

It's already done here: https://github.com/platformatic/rabbitmq-hooks/blob/first-implementation/test/rabbitmq.test.js#L160

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 4c91b05 into main Apr 22, 2024
1 check passed
@mcollina mcollina deleted the first-implementation branch April 22, 2024 12:35
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.

2 participants