@OssaijaD
I see. okay so basically you want a prepared response to a specific event.
If i understand it correctly it can be recurring -> "yeah we scored" should be triggered on every goal, or it can be queued -> "yeah we scored", "woooohooo", " ....."
so if we take a relational model it would be event - 1:n - event response
if you take a document based system like mongo, you just have a list of response objects inside of the document I guess.
my initial idea is something like that
```{
_id: "a4b2ba....",
name: "sports event 1",
type: "event_score",
sportEventTriggerId: ["asdfasdf", "asdfasdfgg"]
response: [
{
_id : "b5a5..."
"message" : "yeah, we scored {{CURRENT_SCORE}} against {{ENEMY_TEAM}}",
"target" : "twitter",
"sent" : 0,
"reccuringSend" : -1,
"active" : true
},
{
_id : "c6a8..."
"message" : "yeah, we are going to win against {{ENEMY_TEAM}}",
"target" : "twitter",
"sent" : 0,
"reccuringSend" : 1,
"active" : true
}
]
}```
so you need at least two endpoints
- /sportsevent/save/[{ID}] [post/put] -> saves the event
- /sportsevent/{ID} [get] -> gets the event with all the data
so now we check the event list you got in your system triggerID and if they exist we execute them. the trigger are basically just the objects about what's really happening
the recurring send in combination with the sent counter can be used to iterate over all message if you want for example 5 recurring messages and you want the next one.
this is just a rough idea what I would have in mind.
j
stuff ;)
so you basically want a state-machine ?
There are several approaches to your requirement I guess:
do you want to retrieve the specific event response ? if yes there has to a be an ID that can be used to fetch the specific response. only 1 time or does it need to be persisted ?
if non of the above is true the answer is "a queue". because that's basically "1 user does something -> it ends in the queue -> another user picks it up.
if it's about broadcasting or pubsub patterns you should definitely use a Queue. maybe zeroMQ or RabbitMQ or beanstalk there are several out there.
You need to be more specific so we could give you a more specific answer -> what I did was basically just stating the obvious without knowing your constraints or purpose.