Skip to content

Instantly share code, notes, and snippets.

@fchaillou
Created September 2, 2016 19:12
Show Gist options
  • Save fchaillou/453fe7ab621870c78c921c4523f84135 to your computer and use it in GitHub Desktop.
Save fchaillou/453fe7ab621870c78c921c4523f84135 to your computer and use it in GitHub Desktop.
EventStoreJvm bug when fetching metadata
import java.util.UUID
import akka.actor.ActorSystem
import eventstore.EventStream.Id
import eventstore.{Content, EventData, EventStoreExtension, WriteEvents}
import scala.concurrent.Await
import scala.concurrent.duration.Duration
object MetadataBug extends App {
implicit val system = ActorSystem()
import system.dispatcher
val connection = EventStoreExtension(system).connection
val uuid = UUID.randomUUID()
val streamId = Id(s"test-$uuid")
val writeCommand = WriteEvents(
streamId = streamId,
events = List(EventData("eventType", UUID.randomUUID(), Content.Json("""{"happy" : true}""")))
)
val metadataFuture = for {
writeCompleted <- connection.future(writeCommand)
readMetata <- connection.getStreamMetadata(streamId)
} yield readMetata
val metadata = Await.result(metadataFuture, Duration.Inf)
if(metadata == Content.Empty) {
println("ok")
} else {
println("Unexpected metadata")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment