Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/aggregate di #52

Merged
merged 16 commits into from
Mar 10, 2016
Merged

Feature/aggregate di #52

merged 16 commits into from
Mar 10, 2016

Conversation

qejk
Copy link
Member

@qejk qejk commented Jan 23, 2016

No description provided.

@qejk qejk added the WIP label Jan 23, 2016
@rhyslbw rhyslbw added this to the 3.x milestone Jan 23, 2016
@rhyslbw
Copy link
Member

rhyslbw commented Jan 25, 2016

I need to prioritise the next release's breaking changes and there's a bug we need to investigate too. This can go to a minor release 3.x.0 if needed, but having said that, are there any issues with this from your point of view, or do we just need code review?

@qejk
Copy link
Member Author

qejk commented Jan 25, 2016

Forgot there is better way to handle commands and events on existing aggregate - will tackle that today. Then tests, and were done here.

@rhyslbw
Copy link
Member

rhyslbw commented Jan 25, 2016

Ok, then let's bring it into 3.0.0 as it's a nice feature worthy of the major release

@rhyslbw rhyslbw modified the milestones: 3.0.0, 3.x Jan 25, 2016
}

eventMap: -> {
'CustomerApp.CustomerCreated': (event) -> @name = event.customerName
'CustomerApp.CustomerCreated': (event) ->
@myEventDependency()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a use-case for this within a state-change event handler?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think none, misunderstood the concept:

Aggregate:
Fired command on new Aggregate -> Router::_setupInitializingMessage -> new instance and injection
Fired command on existing Aggregate -> Router::_genericCommandHandler -> find instance and injection

events on both paths still have access to dependencies.

Process:
Fired command/routed event on new Process -> Router::_setupInitializingMessage -> new instance and injection

Routed event on new Process -> Router::_genericEventHandler -> find instance and injection (so thats why this only relates to EXTERNAL EVENT HANDLERS)

Is that right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good

events on both paths still have access to dependencies.

This is expected, it's up to the implementor to know where not to use deps :-). We will need to have clear instructions for:
• aggregate state changing event handlers should never use an external dependency
• provide use-cases for when to use an external dependency prior to state-change

At a later time it would be ideal to abstract the internal state-change event mapping, as we could then just provide a mapping without the option of accessing a dependency.

@rhyslbw
Copy link
Member

rhyslbw commented Jan 26, 2016

See: meteor-space/messaging#28

I think this in combination with CommandBus/EventBus middleware will be the best approach for command validation and configuration-based business rules. Let's try to wrap the feature here so it's in the 3.0.0 release.

@rhyslbw
Copy link
Member

rhyslbw commented Jan 28, 2016

@DominikGuzei I've just assigned this to you for review. Looks good to me

'tests/infrastructure/handling-domain-errors.tests.js'
'tests/infrastructure/handling-domain-errors.tests.js',
// INTEGRATION
'tests/integration/event-sourceable_dependency_injection.js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please let's just use dashes in filenames to stay consistent

@rhyslbw rhyslbw modified the milestones: 3.x, 3.0.0 Jan 28, 2016
@rhyslbw
Copy link
Member

rhyslbw commented Jan 28, 2016

Just punted this non-breaking feature to the next feature release as it's now the only blocker for 3.0.0

Direct talking with Injector dependency on Router rather then using _injectDependencies wrapper
@qejk qejk removed the WIP label Jan 30, 2016
# Conflicts:
#	tests/test_application.coffee
@qejk qejk added the WIP label Feb 1, 2016
@qejk qejk removed the WIP label Feb 6, 2016
DominikGuzei added a commit that referenced this pull request Mar 10, 2016
@DominikGuzei DominikGuzei merged commit 0bf1ee3 into develop Mar 10, 2016
@darko-mijic
Copy link
Member

We need changelog updated and version number before the release

@DominikGuzei
Copy link
Member

Ah sorry for that, im deep in another project and problem solving 😉 should not merge in that case.

@darko-mijic
Copy link
Member

It is fine. We will cover that in release branch.

@rhyslbw
Copy link
Member

rhyslbw commented Mar 10, 2016

We need changelog updated and version number before the release

@meteor-space/core In future let's try to ensure any new features are added to the changelog under the heading "next". Version numbers should remain only a concern of the release, managed in a separate branch.

@darko-mijic
Copy link
Member

@meteor-space/core In future let's try to ensure any new features are added to the changelog under the heading "next". Version numbers should remain only a concern of the release, managed in a separate branch.

Yes, this is a very good practice introduced by Rhys which makes releases easy. And author of the change probably is the best person to write what is changed rather then reviews. I would also suggest that we add snippets of examples how new features can be used. We can move that to proper documentation and link to it from the changelog eventually. Shall we restore this branch?

@rhyslbw
Copy link
Member

rhyslbw commented Mar 10, 2016

No a merge is a merge, if anything a new chore branch

@darko-mijic
Copy link
Member

OK, than we should delete this branch and create a new one.

@darko-mijic
Copy link
Member

I would also suggest that we add snippets of examples how new features can be used.

This is one possible approach for creating the documentation (for new features that must touch on some existing features and therefore have even more value) while generating documentation from comments is not there.

@darko-mijic
Copy link
Member

@meteor-space/core Shall we consider releasing this?

@qejk
Copy link
Member Author

qejk commented Mar 23, 2016

Imo we should have examples pointing out good and bad practices here - since someone can assume full freedom while using DI and its not the case here.

@darko-mijic
Copy link
Member

I started using this today. I have real world examples. Maybe we should join or experiences @qejk and continue working on this. This is really good and worthy contribution to ES aggregates/processes. We should also address current implementation of aggregate states. And messaging middleware.

@rhyslbw rhyslbw deleted the feature/aggregate-di branch April 7, 2016 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants