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

Bycorrid #1622

Merged
merged 6 commits into from Nov 12, 2018
Merged

Bycorrid #1622

merged 6 commits into from Nov 12, 2018

Conversation

gregoryyoung
Copy link
Contributor

This PR adds a new internal projection $by_correlation_id. This makes a stream per correlation id which can be useful in many scenarios. In the future this is the internal work required for building up the correlationid graph which will also use causationid to show the full graph.

var metadata = JObject.Parse(data.Metadata);
var indexedEventType = data.EventType;

string correlationId = metadata["$correlationId"].Value<string>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the property key "$correlationId" configurable (similar to how category has a configurable option). Currently we use "correlationId" in our metadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It ha always been $correlationId (ued by projection etc a well internally). You could however write your own projection which is equivalent in js pretty easily.

fromAll().
when({
$any : function(s,e) {
if(e.metadata.correlationId) {
linkTo("MyCorrelationId-" + e.metadata.correlationId, e);
}
})

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct, we currently use our own by_correlation_id projection (which is almost identical to this one), it would just be nice to be able to switch over to the built in one instead. If it's too difficult to make this configurable similar to category, I understand.

fromAll().when({
  $any:(function(s,e) {
    if (e.metadata === null) return;
    var correlationId = e.metadata.correlationId;
    if (!correlationId) return;
    var formattedCorrelationId = correlationId.replace(/-/g, "");
    linkTo('$process.event.CorrelationId-' + formattedCorrelationId, e);
  })
})

Copy link
Member

Choose a reason for hiding this comment

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

@Salgat please note that this has now been added.
the projection source now accepts a json string to set a custom correlation id property, example: {"correlationIdProperty":"$myCorrelationId"}

@shaan1337
Copy link
Member

@gregoryyoung can you please squash your commits? I've also pushed a few fixes. Will test again tomorrow and merge.

@shaan1337 shaan1337 force-pushed the bycorrid branch 3 times, most recently from 450cb45 to 9fe09fd Compare May 28, 2018 12:59
@shaan1337 shaan1337 added this to the v4.2 (RC) milestone Aug 16, 2018
@avish0694 avish0694 self-requested a review August 21, 2018 10:37
@jen20 jen20 added area/documentation Issues relating to project documentation and removed documentation needed labels Aug 30, 2018
@Lougarou Lougarou merged commit 8cc0b8c into master Nov 12, 2018
@Lougarou Lougarou deleted the bycorrid branch November 12, 2018 10:30
@ChrisChinchilla
Copy link
Contributor

@shaan1337 and @gregoryyoung Is this also going to be in the Web Admin UI? As I'm creating docs for that too right now.

@ChrisChinchilla
Copy link
Contributor

Ah sorry @shaan1337 @gregoryyoung this is for that new feature that will come.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Issues relating to project documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants