Automatonymous | A state machine library for .Net - 100 % code - No doodleware | Machine Learning library
kandi X-RAY | Automatonymous Summary
kandi X-RAY | Automatonymous Summary
Automatonymous is a most awesome state machine for .Net applications. It allows you to most quickly write state machines for .Net software, supporting 4.5 and higher.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Automatonymous
Automatonymous Key Features
Automatonymous Examples and Code Snippets
Community Discussions
Trending Discussions on Automatonymous
QUESTION
I'm having trouble getting MassTransit (v 7.3.1) saga with scheduled events to work using ActiveMQ Artemis 2.19.0 running in a Docker container. Everything works without any exception, but the publishing of the event is not delayed no matter what delay I specify.
I've tried reproducing the same use case using the test harness, but here everything works as expected.
UPDATED I've added debug logging for MassTransit, to get a better idea of the timeline.
Here is my test code, with one green test using the test harness, and one failing test using ActiveMQ.
...ANSWER
Answered 2022-Mar-08 at 17:14Behind the scenes MassTransit uses the OpenWire protocol to communicate with ActiveMQ Artemis. Currently ActiveMQ Artemis doesn't support the AMQ_SCHEDULED_DELAY
header used by such OpenWire clients. I have opened ARTEMIS-3711 to deal with this and sent a pull request. This should be fixed in ActiveMQ Artemis 2.21.0 which should go up for a vote near the end of this month.
QUESTION
I am looking for best .Net Saga framework. Automatonymous looks promising, but all samples and docs are related to it's parent MassTransit project.
Is it possible to use Automatonymous based saga without MassTransit itself? If yes - how would you persist saga state and how would you rehydrate saga state when new messages arrives? I can't find anything regarding this topic despite 3 days of search.
...ANSWER
Answered 2022-Jan-22 at 12:59Automatonymous is (well, was, but still is) a standalone project. But it has seen limited adoption outside of MassTransit for the reasons you state: instance management, loading and saving instances, identity, etc.
Which is why with v8 of MassTransit, the Automatonymous codebase has been fully integrated to provide a seamless developer experience. Concerns such as instance/state management are handled by the saga repository, which is message-based. I haven't thought about providing any other affordances to dispatch events to state machines outside of the saga repository at this point.
QUESTION
I have this console application project where I use EF6 with postgresql, Quartz and Mass Transit and as DI I use Castle Winsdor. The goal of the project is to check periodically a folder (or folders) for new files and process them (mostly by storing data in the DataBase).
I wanted to use a logging service for debug purposes and I came across Serilog. I managed to add it to Quartz and EF, but I have issues adding it to Mass Transit.
What I've done so far:
I've added Serilog as Logging for Castle.Core.Logging
ANSWER
Answered 2021-Aug-13 at 13:06You need to use the Serilog.Extensions.Logging
NuGet package, which adds ILoggerFactory
support to Serilog. You can pass that interface to configure MassTransit via:
QUESTION
Trying to follow the example on how to test a Saga that uses DI (https://masstransit-project.com/usage/testing.html#testing-using-dependency-injection)
...ANSWER
Answered 2021-May-12 at 12:28There is support, you just have to configure it:
QUESTION
Documentation states that custom activities should be used when
the complexity is best encapsulated in a separate class rather than being part of the state machine itself
https://masstransit-project.com/usage/sagas/automatonymous.html#custom
My question is, what you should and absolutely should NOT do in the activity? For example, should I be making HTTP calls? e.g
...ANSWER
Answered 2021-Apr-29 at 13:49In general, making these types of requests (such as HTTP) is not recommended. Sagas execute within the context of a database transaction, and for that reason adding an external dependency, such as a slow or perhaps unavailable HTTP resource can cause the concurrency throughput to drop significantly if sagas are blocked waiting on external systems.
It might be better to have a separate consumer responsible for querying the remote system, and send/publish a command from the saga which the consumer would use to retrieve the data and report it back to the saga (either via a response, or an event observed by the saga).
The concurrency mode doesn't matter. For instance, if the saga is waiting on an HTTP request, and optimistic concurrency is used, if another event updates the saga while the current event is waiting on an HTTP response, when the saga tries to persist it would fail due to a concurrency/version conflict as it was updated by the other event.
So, when it comes to sagas, short and sweet should be the goal, delegating all the heavy lifting to other components. Sagas should orchestration work, and not do too much work themselves.
QUESTION
I managed to implement MassTransit Courier routing slip with bunch of activities. I decided to add a state machine to monitor it, so I created separate events and states and used EF Core as a storage for an Automatonymous state machine. To track the current state, I publish an event at the end of execution of each activity. It all works and I can monitor current state of routing slip in the database.
But is it the best way to do it? According to this section in the documentation of MassTransit: https://masstransit-project.com/advanced/courier/events.html it looks like events should be published automatically. So maybe there is another way to monitor routing slip, which does not require creating events and manually publishing them in each activity?
...ANSWER
Answered 2021-Mar-03 at 13:18When a routing slip is executing, MassTransit will publish events for each routing slip activity as well as an event once the routing slip has completed.
You can use those events, rather than creating your own, to monitor the routing slip from start to finish (all events are correlated by TrackingNumber
).
If you have multiple routing slips in your system for different transactions, you can specify subscriptions to route those events directly to the tracking saga for each transaction, instead of publishing, so they don't overlap into separate tracking sagas.
These events are best used for monitoring/tracking routing slip execution, and should not be used in place of business events. For instance, if your activity charges a credit card, it would make sense to publish a "CreditCardCharged" event with the details for auditing/tracking the card transaction separately for accounting/legal purposes.
QUESTION
I am trying to configure Automatonymous worker implementation with EF Core as persistence. I publish event via api and process it in hosted service using RabbitMq as a transport. Unfortunately database does not store state of machine. I applied migrations and I see table OrderState
, but there is no data in it after I publish OrderSubmmited
event. It gets processed properly, because I see a log in a console, but database table remains empty. What am I missing?
This is my code:
Event:
...ANSWER
Answered 2021-Feb-22 at 19:11In your code example, you aren't adding the saga, or configuring the saga on a receive endpoint. The consumer is a separate thing, and completely unrelated to the saga. You should be calling:
AddSagaStateMachine()
And then either using ConfigureSaga
or switching to ConfigureEndpoints
for the endpoint to be configured automatically.
QUESTION
What exactly is a consumer saga, and how is it different from Automatonymous? I know that Automatonymous is a separate library that is used by MassTransit.
...ANSWER
Answered 2021-Jan-14 at 13:31Consumer sagas, for lack of a better name, are the original sagas implemented by MassTransit when it was created 13 years ago. They were consumers with state and used variants of IConsumer
to direct messages to saga instances. Consumer sagas implement one or more interfaces to consume correlated saga events. This support is included so that it is easy to move applications from other saga implementations to MassTransit.
State Machine Sagas, which use Automatonymous, provide a powerful state machine syntax to create sagas. They are more flexible in terms of event correlation, and have a fluent syntax for defining state and behavior. They also work nicely with dependency injection via the creation of custom activities which are resolved at run-time for each message.
Automatonymous was written separately to enable its use out of MassTransit, but it by the same author (me).
QUESTION
I am new to microservices and using masstransit with automatonymous. Currently my state machine is showing inconsistency while execution. The code inside Initially works as expected but the control flow does not execute the code inside During after the second event has completed. This happens only for 1 state machine, all the other state machine works as expected. When I move the code inside During to Initially(commented code in initially), it works fine. Below is how my state machine looks like:
...ANSWER
Answered 2020-Oct-25 at 14:53If you are observing events delivered to the state machine prior to the Initially event completing, you should add UseInMemoryOutbox
to the receive endpoint (before the state machine configuration). This will defer outbound messages until the state machine instance is persisted. My suspicion is that you are using an optimistic locking strategy, and the second event is arriving prior to the initial event persistence completing.
QUESTION
We are using Masstransit with automatonymous and InMemoryRepository for saga persistence. We have around 3 state machines configured and working perfectly. We recently changed from InMemoryRepository to EFCore for persistence. This resulted in only the 1st configured state machine to work perfectly. Rest all statemachines are not even entering the Initially event. Need help to understand if the implementation is correct or not. Below are code details:
masstransit statemachine setup
...ANSWER
Answered 2020-Nov-06 at 08:54So below are the changes i did to ensure the statemachine works as expected. The changes were done based on @Chris suggestion in comments, even though our initial implementation of the statemachine was based on the docs on sqlserver efcore persistence.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Automatonymous
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page