Closed ghost closed 11 years ago
ok?
I decided to move on...upon further exploration of the eventdenormalizer module and docs, it looks like an explicit call is necessary to dispatch an event to the denormalizer. If I'm correct, where do you typically implement this call?
sorry I've not so much documentation at the moment...
usually domain and eventdenormalizer are on separate machines or at least processes and speaks via a messagebus myBus.on('event', function(evt) { contextEventDenormalizer.denormalize(evt); });
if you want a solution without message bus look at node-cqs
or wrap up domain and eventdenormalizer: domain.on('event', function(evt) { contextEventDenormalizer.denormalize(evt); });
for some docs look at: http://adrai.github.com/cqrs/pages/eventdenormalizer.html
No worries about lack of docs...I did try to follow along source before posting my question. Sorry if these are novice questions, I appreciate your time.
I'm following you with separate process for domain / event denormalizer, but I still don't see the how the event will published to the bus. In other implementations, I've seen this done in a repository post aggregate handling, with an explicit call like:
dummyAggregate.doSomething(); repo.save(dummyAggregate); // which looks at uncommitted events and publishes them to the event bus.
In your previous comment, is myBus.on('event')... do your modules have an implementation to announce the event to the bus?
Thanks, again.
workflow:
this is cqrs... ;-)
Yes, I'm on the same page with you on the workflow. And it would appear that by convention the cqrs-domain module is performing #3 - #6.
However in #7, I'm not seeing the eventdenormalizer receiving the events using default configuration based on the docs provided. I've stepped through the module's execution and I see the events getting queued up for dispatch, but it appears that nothing is processing them. So my original issue stands...Is there additional configuration/wire-up to get that dispatch of events to the denormalizer to occur, or is this something I would need to implement (where do you typically do this)?
Can you give me more information? What is the last point that reaches your event? Is the event leaving the domain?
...
domain.on('event', function(evt) {
// send to bus
// Does your event reach this point?
});
...
// Do you pass that event to the contextEventDenormalizer?
contextEventDenormalizer.denormalize(evt, function(err) {
// saved in event queue...
});
...
var base = require('cqrs-eventdenormalizer').eventDenormalizerBase;
module.exports = base.extend({
events: ['dummied', {'dummyCreated': 'create'}, {'dummyChanged': 'update'}, {'dummyDeleted': 'delete'}],
collectionName: 'dummies',
dummied: function(evt, aux, callback) {
// Does your event reach this point?
callback(null);
}
});
...
contextEventDenormalizer.on('event', function(evt) {
// send to client, or host...
// Does your event reach this point?
});
See my responses inline:
...
domain.on('event', function(evt) { // send to bus // Does your event reach this point? NO });
...
// Do you pass that event to the contextEventDenormalizer?
**No, I do not have this code implemented. Is this code necessary? This is confusing to me, because I see code in the domain module that seems to publish events for dispatch the eventEmitter (bus?) by convention. This is likely my problem and maybe you can explain the design of this part of the modules? If it is necessary, I don't see a good place in my app to implement this code, where do you suggest it be implemented?
contextEventDenormalizer.denormalize(evt, function(err) { // saved in event queue... });
...
var base = require('cqrs-eventdenormalizer').eventDenormalizerBase;
module.exports = base.extend({
events: ['dummied', {'dummyCreated': 'create'}, {'dummyChanged': 'update'}, {'dummyDeleted': 'delete'}],
collectionName: 'dummies',
dummied: function(evt, aux, callback) {
// Does your event reach this point? No
callback(null);
}
});
...
contextEventDenormalizer.on('event', function(evt) { // send to client, or host... // Does your event reach this point? No });
ok, let's go a step back... :-)
How is your command look like? Can you show me your CommandHandler? Can you shous me your Aggregate? How is your event look like?
Can you show me a bit of your code?
git clone git://gist.github.com/4045196.git gist-4045196
git clone git://gist.github.com/4048442.git gist-4048442
Ok, I see the pieces I missed, all working now. Thanks for the help (and patience).
I think I'm missing something simple but I'm not sure if it's config or implementation. My issue is that I'm not seeing events reaching my denormalizer(s). I've wired in modules cqrs-domain & node-cqrs-eventdenormalizer, with basic configuration using InMemory storage/queues. I've left out all optional configuration.
In the execution sequence, everything is happening in aggregates as expected, but I'm not seeing a publish to the denormalizer. Any hints on how to wire this up would be greatly appreciated.