Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

AsyncMessageProcessorRoute#21

Merged
alechenninger merged 4 commits into
masterfrom
message-processor
Feb 16, 2016
Merged

AsyncMessageProcessorRoute#21
alechenninger merged 4 commits into
masterfrom
message-processor

Conversation

@alechenninger

Copy link
Copy Markdown
Contributor

This can be used to asynchronously process messages which have business logic completely independent of each other.

For example, incoming document messages can be parsed and as part of processing, update (or insert) entities in a data store (such as lightblue). The handling of any incoming document doesn't need to know about any other. Perhaps you could argue that it could benefit from this, such as if two documents referred to the same entity, then they could coordinate and do one update instead of two, but this is something we should talk about later.

It could also be used to handle incoming messages were are more like "requests" or "command messages" which as a result of processing do something else.

It's generic enough that I think eventually maybe our other types of events could be brought together under this kind of model but, for now those differ in that, in least for document events, processing involves coordinating many document events together and optimizing them, so it is not natural to implement with this additional abstraction just yet.

On the other hand, Notifications as currently implemented could be handled in this model actually. But this is for another conversation, and another PR :).

They are just "Messages" and messages can be "processed."

It follows that it is an appropriate abstraction for messages which,
in processing, do not need to know about any other message, and do not
produce a result other an indication of "success" or "failure" where
failure is indicated by an Exception, and success is indicated by the
absence of an Exception.
This gives more diagnostic information, and allows us to include the
subset of failures which happen before we have a parsed message.
private final MessageFactory messageFactory;

private final int idCount = idCounter.getAndIncrement();
private final String routeId = "async-message-repository-" + idCount;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What meaning does this have? I'd rather see the routeId be something meaningful... like maybe just 'async-message-repository' or somehow encoding the fromUri...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Numeric portion is just so multiple can be instantiated in the same camel context, which is mildly useful if only for testing purposes. fromUri is typically broadcast in many camel log messages so I think it may be redundant to include in routeId / maybe somewhat atypical from what I've seen.

@kahowell

Copy link
Copy Markdown
Member

Looks good overall. I had a couple minor comments, but nothing big. Merge when ready.

@alechenninger

Copy link
Copy Markdown
Contributor Author

Thanks!

alechenninger added a commit that referenced this pull request Feb 16, 2016
@alechenninger alechenninger merged commit 9b13cdb into master Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants