Closed ifandelse closed 9 years ago
I'm keeping track of lux's message contracts here as I work on this:
Description | Current Topic | New topic |
---|---|---|
action is dispatched (ex - by a component) | action | action.initiate |
action coordinator telling store to handle an action | dispatch.${storeNamespace} | dispatch.action.${storeNamespace} |
action coordinator telling store(s) they can notify listeners of state change(s) | notify | dispatch.action.complete |
asking a specific store for its state | notify.${storeNamespace} | store.${storeNamespace}.getstate |
store publishing it's state/changed keys | notification.${storeNamespace} | store.${storeNamespace}.updated |
store publishing that it had no changes | nochange.${storeNamespace} | store.${storeNamespace}.nochange |
store registering with the dispatcher | register | store.register |
action coordinator notifying listeners of stores that are about to send notifications | prenotify | dispatch.action.prenotify |
if any store fails in an action, action coordinator sends this | failure.action | action.failure |
it's possible to change the action.* topics to be action.${actionName}.* - but that information has to exist in the payload already, and isn't necessarily vital to routing.
I think what you provided are far more clear than what is there currently. Lots of varied thoughts, but since most of this is behind the scenes anyway – I probably don't feel super strongly about any of this if you disagree:
action.initiate
to dispatch.action.call
(or .start
or .initiate
)dispatch.action.${storeNamespace}
to store.${storeNamespace}.action
(to line up with the other store pieces)action.failure
to dispatch.action.failure
Then all calls would be either prefixed with dispatch
or store
and the store handlers would all follow the convention store.${storeNamespace}.[whatever]
Some other thoughts:
I'd probably lean toward dispatcher
over dispatch
as the namespace. Dispatch sounds like a command, but when used for dispatch.register
its clearly a namespace, but the command feel mixes messages.
Finally, store.${storeNamespace}.updated
paired with .nochange
seems mis-aligned somehow. Perhaps store.${storeNamespace}.change
(or .changed
) instead?
Cool - thanks @dcneiner, good thoughts. Interested to hear @arobson as well, and then I'll make another pass.
The topics used for lux message contracts need to be updated to more expressive (and categorizable) options.