Skip to content
This repository was archived by the owner on Oct 22, 2018. It is now read-only.
This repository was archived by the owner on Oct 22, 2018. It is now read-only.

[wishlist] Add a publish end-point... #54

@jonasfj

Description

@jonasfj

Design:

POST /v1/namespace/<namespace>/exchange/<exchange>
scopes: [['pulse:namespace:<namespace>'], ['pulse:namespace:<namespace>/<exchange>']]
        // either:  pulse:namespace:<namespace> or pulse:namespace:<namespace>/<exchange>
{
  routingKey: '...',
  message: {...},
}

From client:

await pulse.publish(namespace, exchange, {
  routingKey: '...',
  message: {...},
});

The general idea is that this publishes a message (and creates the exchange if it doesn't exist).
taskcluster-pulse can have it's owner super-user on rabbitmq, so it doesn't need to create a user
for the namespace...

This could be useful in environments where you can't open a TCP connection, say sending a pulse message from a browser.. Perhaps that could be useful in certain applications..
It could also be useful in languages that doesn't have good rabbitmq libraries, or for developers who are super lazy and thinks it's easier to publish messages through a REST api call than an rabbitmq connection...

Obviously, this wouldn't be able to handle a high load of message publications, for that people would be much better off using a direct connection to rabbitmq... but I suspect it could be useful in places where people only send an occasional message.
In fact, I suspect a single dyno on heroku could publish a hundred messages per second or so :)

Note:
Perhaps we could simplify scope patterns a bit, by using: pulse:namespace:<namespace>/<exchange>.
The pulse.namespace(namespace) end-point would then require the namespace: pulse:namespace:<namespace>/* which implies that can publish to any exchange under the namespace.


Thoughts? is this doable? would it be useful later?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions