title: Event sourcing incremental int id
body: <p>I looked at a lot of event sourcing tutorials and all are using simple demos to focus on the tutorials topic (Event sourcing)</p>
  
  <p>That's fine until you hit in a real work application something that is not covered in one of these tutorials :)</p>
  
  <p>I hit something like this.
  I have two databases, one event-store and one projection-store (Read models)
  All aggregates have a GUID Id, what was 100% fine until now.</p>
  
  <p>Now I created a new <code>JobAggregate</code> and a Job Projection.
  And it's required by my company to have a unique incremental int64 Job Id.</p>
  
  <p>Now I'm looking stupid :)
  An additional issue is that a job is created multiple times per second!
  That means, the method to get the next number have to be really safe. </p>
  
  <p>In the past (without ES) I had a table, defined the PK as auto increment int64, save Job, DB does the job to give me the next number, done.</p>
  
  <p>But how can I do this within my Aggregate or command handler?
  Normally the projection job is created by the event handler, but that's to late in the process, because the aggregate should have the int64 already. (For replaying the aggregate on an empty DB and have the same Aggregate Id -> Job Id relation)</p>
  
  <p>How should I solve this issue?</p>
  
  <p>Kind regards</p>