Comments (10)
Hey @AnnaRedziak. Version 2 is stopped at the moment for personal reasons. Will try to come back to work as soon as I can. Thanks!
PS: This feature is already developed and available at v2 branch in case you want to start having a look.
from spec.
Hey @jedibatman!
Thanks for opening the issue. I'm not clear with the use case (chat rooms). Does it mean that somehow your message contains to which chat room is the message going to be sent? For instance:
chatRoom: general
message: hello, how are u?
In this case I suppose your message always have the same structure. It is, it has a chatRoom property and a message property.
Am I missing something?
from spec.
While what you have illustrated is correct, perhaps a chatroom is too simple of an example.
Suppose you have a bounded context of some kind -- let us take for example posts and comments on those posts. One might want to subscribe to all updates that are within the same context of a given post -- i.e. post.{:id}
.
To further illustrate the concept, let us assume that a Post
can be updated, users can create Comment
's on a Post
, and can additionally edit/update the Comment
's that they created.
It would be valuable to allow the ability for a consumer of the async api to subscribe to a Post
such that they can receive realtime updates (messages) that represent creation and updates to any Comment
's that have an association to the given Post
.
So in this scenario, there are at least 3 distinct events that can flow through the same topic:
- the update of a
Post
- the creation of a
Comment
associated with aPost
- the updating of a
Comment
associated with aPost
Hopefully that provides enough elaboration to clarify the concept.
I think, to some extent, what I am advocating for is a message schema that has common attributes for all possible messages whereby the message can be identified to represent a specific event
and contained within the message is the payload
for said event. As an example:
{
"topic": "topic.sometopic",
"event": "some_event",
"payload": {
// the payload of "some_event"
}
// additional meta attributes that make up a message -- i.e. a correlation_id, sequence_id, etc.
}
from spec.
Ok, understand what you mean. I'm gonna explain what's my approach in this case as it seems that you're moving the message broker logic to your app.
What you described before could be accomplished by just publishing/subscribing to a topic like post.{:id}
and post.{:id}.comment
. This will translate in AMQP to something like post.*
and post.*.comment
respectively.
Please make use of topics to route the messages properly, otherwise your application could receive much more messages than you can handle. In a system like the one you described, imagine you want to separate into 2 different services "Post CRUD" and "Comments CR". In the service in charge of managing posts you'll receive messages related to comments. At scale it could cause your service to get stuck trying to inspect the message to filter for the ones that contain a specific topic.
That said and even though I don't recommend the approach of multiple messages structures per topic, I'll consider adding it to the spec.
Thanks!
from spec.
This will be addressed in v2 as it's a breaking change.
from spec.
Hello, we have the same problem/requirement as @jedibatman. In our API, related to management of IoT devices, we receive several kind of messages over the same topic, for example all the actions messages go through the same topic. Also we publish several kind of messages in the same topic, for example all the measurements devices.
@fmvilas , is this, in your opinion, a bad design? will be this scenario accepted in V2.0.0? what is more or less the due date for V2.0.0?
Thanks
from spec.
is this, in your opinion, a bad design?
Not necessarily bad, but I'd always recommend to take advantage of broker's routing features whenever possible for the reasons described above and also for performance. However, I understand AsyncAPI should not enforce any implementation details.
will be this scenario accepted in V2.0.0?
Yes, it's already accepted.
what is more or less the due date for V2.0.0?
TL;DR I don't know. I'll do my best.
I'm the only maintainer right now so it stongly depends on my time right now. I'm always looking for people wanting to join and dedicate some time to the project. If you have a need you might want to join and help prototype version 2.0.0.
Cheers!
from spec.
Hey, @fmvilas , this is very interesting. So, is there any progress in V.2.0.0 ? When will this feature be developed and available?
Kindest regards.
from spec.
I'm closing this issue as this feature can be achieved by fixing #58.
Example:
topics:
myTopic:
publish:
anyOf:
- $ref: '#/components/messages/message1'
- $ref: '#/components/messages/message2'
from spec.
🎉 This issue has been resolved in version 1.0.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀
from spec.
Related Issues (20)
- Invite Heiko Henning to join as code owner HOT 11
- Should the Reply Object extend from the Operation Object? HOT 5
- Channel parameter type HOT 2
- Send/Receive again confusion HOT 3
- AsyncAPI v3 retrospective HOT 1
- Undefined description when using `OneOf`, `AllOf` or `AnyOf` HOT 3
- Undefined behaviour of "messageId" for Message Traits and Messages defined in components. HOT 4
- Avro specification inside AsycnApi file HOT 4
- Server Object host field compatibility with protocols HOT 3
- testing -input command not found HOT 2
- Possible bug with example - adeo-kafka-request-reply-asyncapi HOT 18
- Decide what to do with OAS schema properties HOT 5
- Allow plain `string` in Message Example Object field payload for non-json payloads (like xml, yaml) HOT 7
- when to finish amqp serverBindings HOT 2
- Divide "Maintainer" role into two categories: Triager and Committer HOT 7
- How to define MQTT User Properties in an AsyncAPI document? HOT 2
- Extend Avro and OpenAPI schema versions HOT 13
- Multiple reply addresses HOT 2
- Can i document an endpoint for a cron job? HOT 2
- trait vs. allOf ref vs. component ref - CloudEvents HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spec.