Alternative to using Guid

Is there any way I could use a long instead of a Guid as a key in the eventstore? I am trying to support a legacy system, and using GUID is not an option for me.


You can convert the long to a guid:

streams are just strings or are you thinking about neventstore?

I am talking about the following:
public sealed class EventData


public readonly byte[] Data;

public readonly Guid EventId;

public readonly bool IsJson;

public readonly byte[] Metadata;

public readonly string Type;

public EventData(Guid eventId, string type, bool isJson, byte[] data, byte[] metadata);


declared in EventStore.ClientAPI

I need to use a long as the EventId.

As the eventid? why? What are you doing with event ids?

to be more clear, the event id is only used for idempotence not for anything else in the system.


I intend to use the eventstore as a command store too. The flow will b1:

  1. client sends a command to a command service (that has a long as an id - a correlationId)

  2. command gets stored in the eventstore with the id.(as its event id)

  3. a general ack is sent back to the client immediately

  4. then stored ommand is sent to a command dispatcher asynchronously and processed.

  5. Once the command is processed, the actual response is formed and stored back in the eventstore (in another stream)

  6. The client will poll a query server with its correlation Id.

  7. The eventstore is searched using the correlationId for the response, and the response is sent back

This is the use case I am thinking of Let me know if this sounds whacky!

I think there are better ways of doing this. In fact we directly support this internally with projections. As you know there a pattern called “correlationId” there is a related pattern called “causationId” as well as “messageid”

EventId is your messageid.

When responding to a message you take its message id as your causationid and you copy its correlationid. Projections will do this automagically for you if you emit events and have these fields set btw!

So to handle your case:

in metadata


correlationId : 43832487934.

causationId : “guid”


Then you can write commands into a stream let’s call it “incoming”.

You have a processor that reads incoming and writes out events with appropriate correlationid

You can then write a quick projection:



$any : function(s,e) {linkTo(e.metadata.correlationId, e)}


This will create a stream per correlationId. The client can just listen to the atomfeed for anything going on on that correlation id.

Make sense?



Makes sense! , but I need a clarificaion Are projections like the following


$any : function(s,e) {linkTo(e.metadata.correlationId, e)}


supported in C#? Could not find any documentation at the site regarding projections in C# API.



Ah projections are still in beta.

Projections are hosted internally and are written in javascript :slight_smile: