Activity Diagram: Continuous activity triggering event - uml

I'm having trouble modelling a continuous event as well as an activity that happens as part of that continuous event.
I am modelling the tracking of a website by a Marketing Automation platform. However the tracking is a continuous event constantly happening. A part of this tracking is the 'form submit'. This however triggers a new flow of activities creating a contact in the CRM.
Questions:
1. How do I make an activity in 'Tracking' invoke a new flow of activities if a form is submitted?
2. If I model this by using a fork: both (Tracking and form submit) need to occur before the flow is continued.
I basicly need a fork where one flow is optional.
Kind regards,
--- If I made any mistakes regarding posting, please direct me to the correct location / nescecary corrections ---

Basically you are right: you use a fork to create a "forked off" flow. Like #JimlL. I have trouble understanding the details of your question. But basically fork is the way to go.
A few remarks to your diagrams:
The first has a ConditionalNode with no alternatives. That's pretty pointless. I guess you just miss a path down to bypass Log Tracking
The second has an unguarded, unconditional flow top from a fork to a join. That's pointless and you should just remove the flow.
The Form not filled and No form on page flows are also pointless without connected actions (which should likely be some error actions).
The Yes/No should be written in brackets (like [Yes]) to make them guards, which the actually are. I guess the other named flows should also rather be guards.
The fork following Form submit actually does, what you are asking for.
Activity diagrams are derived from Petri nets. You need to imagine a virtual token traveling along the control flows. A fork will fire as many tokens as it has outgoing flows on receipt of an ingoing token. A join will only send outgoing token(s; depending on the number of outgoing flows) once it has received a single token on each incoming flow.

Related

Domain / integration events payload information in DDD CQRS architecture

I have a question about the integration events used in a microservice / CQRS architecture.
The payload of the event can only have references to aggregates or can it have more information?
If only reference ids can be sent, the only viable solution is to bring the rest of the information with some type of call but the origin would have to implement an endpoint and the services would end up more coupled.
ex. when a user is created and the event is raised.
UserCreated {
userId
name
lastname
document
...
}
Is this correct?
If only reference ids can be sent,
Why would only that be allowed? I have worked with a system which was using micro-services, CQRS and DDD(similar like yours) and we did not have such restrictions. Like in most cases it is: "What works best for your application/business domain". Do not follow any rule blindly. This is perfectly fine to put other information in the events Payload as well.
the only viable solution is to bring the rest of the information with
some type of call but the origin would have to implement an endpoint
and the services would end up more coupled.
This is fine in some cases as well but this brings you to the situation to have additional call's after the event has been processed. I would not do this unless you have a really heavy model/models and it would affect your performance. For example if you have an event executed and based on userId you would need to load a collection of related objects/models for some reason. I had one similar case where I had to load a collection of other objects based on some action on user like event UserCreated. Of course in this case you don't want to send all that data in one Event payload. Instead you send only the id of the user and later call a Get api from the other service to get and save that data to your micro-service.
UserCreated
{
userId
name
lastname
document
... }
Is this correct?
Yes this is fine :)
What you could do instead:
Depending of your business scenario you could publish the information with multiple events with Stages and in different States.
Lets say from UI you have some Wizard-like screen with multiple steps of creation. You could publish
event: UserCreatedDraft with some initial data from 1st Wizard page
event: UserPersonalDataCreated with only part of the object related to private data
event: UserPaymentDataCreated with only the payment data created
UserCreatedFinal with the last step
Of this is just an example for some specific scenario which depends on your use case and your Business requirements. This is just to give you an Idea what you could do in some cases.
Summary:
As you can see there are multiple ways how you can work with these kind of systems. Keep in mind that following the rules is good but in some cases you need to do what is the best based on your business scenario and what works for some application might not be the best solution for your. Do what is most efficient for your system. Working with micro-services we need to deal with latency and async operations anyways so saving some performance on other parts of the system is always good.

Continuing a conversation after manually calling the signin helper

I'm a bit confused about how to handle the following scenario:
The user triggers the FooBarIntent whose fulfillment requires a linked account from a third party.
I manually call the signin helper from my fulfillment code.
The user authorizes my agent, Actions on Google sends the helpers response with the signin status to Dialogflow, where a SignIn intent picks it up and passes it to my fulfillment service.
Now how do I proceed with fulfilling the original FooBarIntent? I thought this would somehow be handled seamlessly, but the signin helpers response is an entirely new webhook request with no information about the original request. It seems that I could store that information in a context, but that seems rather clumsy. Am I missing something here, or do I really have to tell the user something like "thanks for logging in, now please ask your original question again"?
Saying "Now please ask your original question again" is certainly the wrong approach to take - you have that part correct.
You're also correct that there is no automatic re-triggering of the original Intent. While this seems odd, it is simply because Intents represent what the user has said - not what you're going to be replying with. Both the user's initial statement and their sign-in acknowledgement are separate things that the user has said, and you may wish to handle each differently.
As you suggest - one thing that makes sense to do is to respond to the initial thing they said before you got the results from the helper. In these cases, saving the Intent or Action name and parameters in a context when you request the helper can let you pick back up afterwards. (There are other possible behaviors, however, that could make sense. Consider, for example, if you request sign-in as part of the welcoming intent. Since the user never gets past this first step, you don't need to keep track of the state.)
This pattern of saving the state when you take a detour to get the sign-in is one that is directly supported by the multivocal library, for example. With multivocal, you specify the requirements necessary before an Intent or Action handler is triggered (such as requiring the user to be authenticated). It takes care of meeting those requirements and then making sure the conversation continues where you left off to take the detour.

How to monitor message (file) processing steps in Spring-Integration

Spring integration really helps us a lot during application integration, it make us more focus on flow design.
However, we want to log all file processing steps and use log analytic tools to check how one specific file(message) been processed.
Question is how to log a grouping id for each message in order to group them for checking by another logging anlytic tools?
thanks
Consider to turn on Message History for your application. This way in the end of flow you can extract such a MessageHistory.HEADER_NAME with all the traveling information for the message.
Otherwise you really don't have choice unless to add some business header in the beginning of the flow and parse logs for such a common key.

What is a correct design pattern for an API mailing/notification system?

I am developing a Rest API using node js, mongo and express as technologies. My models include users, venues, etc. In addition each user has states. Examples of states could be when a user signup the first state is 'new_user', after one week the state must be 'first_week_user' and so on.
The purpose of these states is to notify the user according to his or her state. For example if a user like a picture and the user is in the first week (he has the 'first_week' state) so an email must be sent to him. I am in the design stage right now, so I want to know if somebody had to face the same issue before.
The design that I have in mind is to put a notification_profile inside the user object and using a cron job to check the state and the actions of the day and according to that send the emails/push notifications.
What do you think? Are there a better option? e.g. I can have an email API and queue the emails hitting this API. Do you know where I can find information about design patterns facing this problem?
Thanks a lot for your help.
Without more detail, this sounds like you need the Observer pattern.
Essentially, your Email component would subscribe to each Person object's like(photo photo) event, and either execute an email-send job immediately, or schedule the job to run later, as part of a batch.
One way to specify the state transitions would be as a hierarchical state machine. See http://www.eventhelix.com/realtimemantra/hierarchicalstatemachine.htm#.VNJIflXF--o and http://en.wikipedia.org/wiki/UML_state_machine
I don't have a good node.js example but here's a C# implementation that also includes the concept of timed events. Essentially the state machine keeps track of a NextTimedEventAt so you can efficiently pull it back out of a database at the right time to fire a time-based event.
Actions happen on state transitions: as you enter a state or leave a state.

What action should I use for a complex review?

I am thinking about adding actions to a transactional email that asks a customer to fill in a review and currently links to a web-app where a complex questionnaire with several questions and text fields is available.
The amount of data that is collected is far more than would be achievable with the in app review action. However the registration guidelines state that the most high-fidelity action available should be used, but it doesn't really allow for granular enough data input for my use-case.
Should I use a Go-to action? Or is there a way to use the in-app review action to collect part of the data and then redirect to a partially filled questionnaire to offer the option to answer the other questions?
I think you should use the Go-To action. These are for more complex interactions, when you need to provide a direct link to the page where the action can be performed. They are rendered in an email as a button in the subject line that redirects the user to the page specified in the action definition.
https://developers.google.com/gmail/markup/reference/go-to-action

Resources