How to find an event in EventStore by it Id? - eventstoredb

Currently I'm using Eventstore (by Greg Young) for my company project. In my read model, I store the processed event ids, not the event name. How can I find the event in Eventstore using its Id?

I don't think this is possible currently. I think you have two choices:
in your read model store the stream and index, or the commit/prepare position of the event and then read the event from either the $all stream using the commit/prepare position or from the stream it was written to using the stream and index. This is probably the simplest.
Or create a projection in event store which indexes the events by their id and reprojects into a stream called, say, eventid-{event.id} then you can read directly from this stream.
The second is backwards compatible with your current read model, but I'm not sure is the right thing to do, as projections cause write amplification, and you probably need to make sure you exclude system events from being projected.

You can query the event using the following URL path. This will return the event and the last 20 events before it
{youreventstoredomain}:2113/web/index.html#/streams/$ce-{streamname}/{eventnumber}/backward/20

Related

Add Sensorevents to CEP Engine and get a list of all properties

I want to build a CEP-Engine which is dynamic so you can add different event streams. As soon as a new stream is added, Esper should be able to read all the properties of the stream and put it into a list, for example. (For example integer id, long temperature, date timestamp etc.)
Is this possible in Esper?
Would be very grateful for any help
In order to add a stream at runtime you can use create-schema.
create schema MyStream(id int, ...)
For a stream that accepts events that an application sends using EPEventServive#sendEvent you should add the bus and public annotation (or set the equivalent compiler flags).
#public #buseventtype create schema MyStream(id int, ...)
You can now use this stream.
select * from MyStream
You can attach a listener and have it do some logic.
The Esper examples have a lot of detail. The create-schema is used in the "runtimeconfig" example.
Thank you for answering. I'm afraid I didn't make myself clear. I want to be able to add event streams where I don't know beforehand what kind of properties the events have. So I don't know before if there is an integer ID or if there is a date timestamp and which payload might be there. As soon as I add such an unknown event, Esper should examine the stream and return the contained properties of the stream to me.

Add UNKNOWN eventstreams to CEP Engine and get a list of all properties (payload) of this event

I want to be able to add event streams where I don't know beforehand what kind of properties the events have. So I don't know before if there is an integer ID or if there is a date timestamp and which payload might be there. As soon as I add such an unknown event, Esper should examine the stream and return the contained properties of the stream to me.
Thank you very much. That actually helps me a lot. But a function which returns all property names directly does not exist, does it? So I would have to use dynamic parameters (trial and error) until I know which ones exist in the eventstream.
Thank you for your help :)
See similar to Add Sensorevents to CEP Engine and get a list of all properties
In the case that you don't have some or all of the properties, you can add the stream without any properties or with those properties that you know that the events have. Here is how to add a stream where you don't know any properties in advance:
#public #buseventtype create schema MyStream()
You can now use EPEventServive#sendEvent to send events.
You can use this stream in various ways. You can simply select the event.
select * from MyStream
Or you can use the dynamic property names, those with a '?' questionmark appended to them. This can refer to properties that may or may not exist.
select id? as id from MyStream
The "id?" returns an Object-type value. You can use "cast" to make it, for instance, a double-type value to total up.
select id? as id, sum(cast(someNumericProperty?, double)) as total from MyStream where
When the property doesn't exist the "?" expression returns null. There is an "exists" function that returns true when the parameter that is a dynamic property exists.
I don't think the Esper runtime actually knows about any dynamic property until the EPL attempts to use that dynamic property. The runtime doesn't inspect any event for actual properties.
You can add your own user-defined function that determines what the property names may be for your specific event underlying. So when the underlying is a java.util.Map the user-defined function can return "event.keySet()".

Microsoft graph API: finding event by iCalUid

I would like to decline one instance of recurring meeting. I only have masterSerieId, iCalId, time of that instance.
Do you know how I could cancel that instance?
Do I have to query using masterId and time of the instance to find event id or there is a way I would just find eventId using iCalId?
You can use OData query options to filter on just the event that has that particular iCalUId.
For instance:
GET https://graph.microsoft.com/v1.0/me/events?$filter=iCalUId eq '<your iCalUId>'
Sadly the calendar view endpoint does not include events which are part of an event series if you match against a given iCalUId.
So if an event has a seriesMasterId which is not null, you wont find it by filtering for the iCalUId.

ABAddressBook detect contact record changes

Is there a way to detect which contact records have changed ?
I understand there are 2 options to detect change:
kABDatabaseChangedNotification and
kABDatabaseChangedExternallyNotification
ABAddressBookRegisterExternalChangeCallback
I would like to detect each contact that has been changed. How would I be able to do this ?
I suppose there is no way to detect the individual changes.
Couple of points to keep in mind:
You need to use `ABAddressBookRegisterExternalChangeCallback1 to
specify the callback function
When the callback function is called reload all the contacts from address book.
Use NSOperation and ensure isCancelled is handled.

How do I check for duplicates in event calendar eventkits

I fetched a list of all events and try to match it with my current events about to be added, but it never matches and just add duplicates.
The code I used to fetch is from apple's document. Can anyone help?
http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/EventKitProgGuide/ReadingAndWritingEvents.html#//apple_ref/doc/uid/TP40004775-SW1
Code from another tutorial (I scourged the net but couldn't find how to match events. the fetch predicates results title string comparison did not work)
http://neilang.com/entries/using-eventkit-in-ios/
I found out that one can save the eventstore event unique identifier immediately after saving. And with this identifier one can get the events back.

Resources