catchcake / message_store Goto Github PK
View Code? Open in Web Editor NEWA message store for event driven architecture.
A message store for event driven architecture.
When bad stream name is given, then return nil.
When is recipient in message metadata and subscriber has recipent set in settings, subsciber react only values match. Resolve problem with concurent consumers and only selected one process the message.
Now:
iex> Message.follow(
%{
type: "Test",
data: %{foo: 2},
metadata: %{bar: 1}
},
%{
correlation_id: "1",
event_id: "2",
data: %{},
metadata: %{bar: 3}
},
[:data, :metadata]
)
%EventStore.EventData{
causation_id: "2",
correlation_id: "1",
data: %{foo: 2},
event_id: nil,
event_type: "Test",
metadata: %{bar: 3}
}
Expected:
iex> Message.follow(
%{
type: "Test",
data: %{foo: 2},
metadata: %{bar: 1}
},
%{
correlation_id: "1",
event_id: "2",
data: %{},
metadata: %{bar: 3}
},
[:data, :metadata]
)
%EventStore.EventData{
causation_id: "2",
correlation_id: "1",
data: %{foo: 2},
event_id: nil,
event_type: "Test",
metadata: %{bar: 1}
}
Now function return position in selected stream, but subscriber operate above $all
stream, then event_number
in projection point to stream_version
and in subscriber to global position. These values can't be match for message processed check.
Fetch function must be refactored to use same stream $all
or use own SQL to get global postion.
For subscriptions that have an :origin_stream_name
, we’ll further filter that query result based on whether or not the messages have that :origin_stream_name
in their metadata.
The supervisor does not apply at all, so the subscriber is not restarted. The benefits of Erlang will not be taken advantage of. The system looks functional, but the opposite is true.
GenServer {Goauld.MessageStore.EventStore.Subscriptions.Registry, {"$all", "eu:gemini:components:heartbeat:command"}} terminating
** (FunctionClauseError) no function clause matching in MessageStore.Subscriber.recipient_selector/2
(message_store 0.4.1) lib/message_store/subscriber.ex:130: MessageStore.Subscriber.recipient_selector("eu:gemini", %EventStore.RecordedEvent{causation_id: "125c5329-63d0-529f-8d4e-6d7b7471e276", correlation_id: "125c5329-63d0-529f-8d4e-6d7b7471e276", created_at: ~U[2020-08-31 12:59:41.992250Z], data: %{addrs: ["192.168.0.14", "fe80::30d6:a08:c12b:427d"], host_name: "gemini", id: "125c5329-63d0-529f-8d4e-6d7b7471e276", location: "eu", time: "2020-08-31T12:59:41.986930"}, event_id: "c5b32b72-f541-48cb-a2a4-ed23fc679540", event_number: 1, event_type: "Register", metadata: %{}, stream_uuid: "hostRegistry:command-125c5329-63d0-529f-8d4e-6d7b7471e276", stream_version: 1})
(message_store 0.4.1) lib/message_store/subscriber.ex:109: MessageStore.Subscriber.selector/2
(eventstore 1.1.0) lib/event_store/subscriptions/subscription_fsm.ex:420: EventStore.Subscriptions.SubscriptionFsm.enqueue_events/2
(eventstore 1.1.0) lib/event_store/subscriptions/subscription_fsm.ex:126: EventStore.Subscriptions.SubscriptionFsm.transition/3
(eventstore 1.1.0) lib/event_store/subscriptions/subscription.ex:110: EventStore.Subscriptions.Subscription.handle_info/2
(stdlib 3.13) gen_server.erl:680: :gen_server.try_dispatch/4
(stdlib 3.13) gen_server.erl:756: :gen_server.handle_msg/6
(stdlib 3.13) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: {:events, [%EventStore.RecordedEvent{causation_id: "125c5329-63d0-529f-8d4e-6d7b7471e276", correlation_id: "125c5329-63d0-529f-8d4e-6d7b7471e276", created_at: ~U[2020-08-31 12:59:41.992250Z], data: %{addrs: ["192.168.0.14", "fe80::30d6:a08:c12b:427d"], host_name: "gemini", id: "125c5329-63d0-529f-8d4e-6d7b7471e276", location: "eu", time: "2020-08-31T12:59:41.986930"}, event_id: "c5b32b72-f541-48cb-a2a4-ed23fc679540", event_number: 1, event_type: "Register", metadata: %{}, stream_uuid: "hostRegistry:command-125c5329-63d0-529f-8d4e-6d7b7471e276", stream_version: 1}]}
State: %EventStore.Subscriptions.Subscription{retry_interval: 60000, stream_uuid: "$all", subscription: %EventStore.Subscriptions.SubscriptionFsm{data: %EventStore.Subscriptions.SubscriptionState{buffer_size: 1, conn: Goauld.MessageStore.Postgrex, event_store: Goauld.MessageStore, last_ack: 0, last_received: 0, last_sent: 0, lock_ref: #Reference<0.955217136.1098645505.138139>, mapper: nil, max_size: 1000, partition_by: nil, partitions: %{}, processed_event_ids: #MapSet<[]>, queue_size: 0, registry: EventStore.Registration.LocalRegistry, selector: #Function<2.94935568/1 in MessageStore.Subscriber.init/1>, serializer: MessageStore.JsonSerializer, start_from: 0, stream_uuid: "$all", subscribers: %{#PID<0.517.0> => %EventStore.Subscriptions.Subscriber{buffer_size: 1, in_flight: [], last_sent: 0, partition_key: nil, pid: #PID<0.517.0>, ref: #Reference<0.955217136.1098645505.138087>}}, subscription_id: 1, subscription_name: "eu:gemini:components:heartbeat:command"}, state: :subscribed}, subscription_name: "eu:gemini:components:heartbeat:command"}
Eventstore in version 1.3 load runtime configuration.
For better scalability and portability, the message must not contain strict types. They must not deserialize into a specific structure, but only into a map.
Use more generic function to convert atoms and strings to string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.