Asynchronous communication between ACL and BoundedContext - asynchronous

We are following DDD for a project... We need to access a legacy application from a bounded context . So we create an Anti corruption layer.. However we have a problem... The method that we are executing in the ACL is asynchronous and returns the result via an event... The result of call is used to update a db in the bound context...
In such scenarios can we use Domain Events for communication between ACL and Bounded Context
Thanks in Advance

This sounds more like a technical event than a domain event, but it is difficult to say from your description.
According to your description, the event originates in the ACL, and not in the BC. This is a strong indication that it is not a domain event, because it has no meaning in your domain.
Imagine a perfect world, where you wouldn't need the ACL. Would the event still exist?
Note that you can still use eventing to solve your technical problem though. It just isn't a domain event.

Related

How I should identify shared domain events (Event Sourcing) contracts between microservices?

The problem is that I need a standard way to serialize and deselialize domain events between different microservices (either by a unique identifier for each type event), so the contract type of these messages must be agnostic to the programming language.
Is there any protocol or standard of communication between the passage of events between microsrevices in order to identify them with queues? What is the best way for you? Or some standard framework for communicating these events on net.Core?
We copy the events as external events into the other services. We also use a shared event model to communicate upcoming changes to everyone. https://eventmodeling.org/posts/what-is-event-modeling/
This is a case of the Publisher/Subscriber model/pattern of events. Usually, an organization may define its own format of an event message, which must be followed by each publisher (domain in this case, such as Customer, Order, Product, Payment, etc.), and then the subscriber app/domain will consume the published event [if Subscribed to].
While there are many options available for implementing this, such as RabitMQ, Azure Service Bus, Azure EventHUb, and open-source Kafka or Azure Event Hubs for Apache Kafka. You may want to 1st align the pub/sub and what contract will work best for your organization (you can always evolve).
Please refer to https://learn.microsoft.com/en-us/dotnet/architecture/microservices/multi-container-microservice-net-applications/integration-event-based-microservice-communications for some samples of using RabitMQ if that will interest you.

Generic Exception Handler Orchestration in BizTalk

Hi All BizTalk Developers,
I need some input and guidance on how to design an Orchestration that can take few parameters as Input and log them in SQL server table (tblTrackingData)
I want to start this orchestration at various points, for example when I am calling a webservice so I want to log the request in DB and when I get the response then I want to log the response xml also in the same table.
In case of any exception I want to log error message and other details in the same table for tracking purpose.
Can some one guide me, direct me to some existing blogs/posts on how to handle this generic tracking / exceptions etc by starting a new Orchestration.
The purpose of a new Orchestration is to call it from anywhere, please suggest if it could be handled in a better way also.
Thanks.
The best advice, don't do this.
The reason? Everything you describe is already done by BizTalk Server automatically by BizTalk Tracking and the Event Log.
I can tell you from experience, you will not need anything else beyond Tracking and the Event Log.
I do recommend you implement proper exception handling within you app and log custom events, but they would also be written to a Windows Event Log only as well.

Can the Tridion Core Service be notified of data changes?

I'm implementing a Core Service "Facade" for some lazy programmers that don't want to change their coding style (me included), and wanted to implement object cache, which obviously leads to the grand question of "how long and how much should I cache".
The ideal answer is to cache forever except when data is changed.
Is there a way (via some WCF event perhaps) to implement a "listener" for data changes that could be used to remove items from their cache?
BTW, I am using .NET's native ObjectCache (MemoryCache) with a 1 minute sliding cache policy for now.
Thanks,
N
There is no such system built-into either WCF or Tridion that I know of.
You could of course roll your own, where you:
Listen for changes to the relevant data on the TCM server with Event Handlers
Have those event handlers forward the event to a central notification server
Have your WCF clients register with that notification server when they start up
Have notification server subsequently send the notifications on to the connected clients
This is essentially quite similar to how Tridion's Broker Object Cache works on the Content Delivery tier.
If you're interested in implementing such an approach, I'd suggest having a look at the Signalr project, which takes a lot of the hassle out of it.
Edit: it turns out WCF has something akin to what you're asking for called Callbacks. See this question and this blog post.

Attaching an event listener to all URLRequest's

We have a flex application that connects to a proxy server which handles authentication. If the authentication has timeout out the proxy server returns a json formatted error string. What I would like to do is inspect every URLRequest response and check if there's an error message and display it in the flex client then redirect back to login screen.
So I'm wondering if its possible to create an event listener to all URLRequests in a global fashion. Without having to search through the project and add some method to each URLRequest. Any ideas if this is possible?
Unless you're only using one service, there is no way to set a global URLRequest handler. If I were you, I'd think more about architecting your application properly by using a delegate and always checking the result through a particular service which is used throughout the app.
J_A_X has some good suggestions, but I'd take it a bit farther. Let me make some assumptions based on the limited information you've provided.
The services are scattered all over your application means that they're actually embedded in multiple Views.
If your services can all be handled by the same handler, you notionally have one service, copied many times.
Despite what you see in the Adobe examples showing their new Service generation code, it's incredibly bad practice to call services directly from Views, in part because of the very problem you are seeing--you can wind up with lots of copies of the same service code littered all over your application.
Depending on how tightly interwoven your application is (believe me, I've inherited some pretty nasty stuff, so I know this might be easier said than done), you may find that the easiest thing is to remove all of those various services and replace them by having all your Views dispatch a bubbling event that gets caught at the top level. At the top level, you respond to that event by calling one instance of your service, which is again handled in one place.
You may or may not choose to wrap that single service in a delegate, but once you have your application archtected in a way where the service is decoupled from your Views, you can make that choice at any time.
Would you be able to extend the class and add an event listener in the object's constructor? I don't like this approach but it could work.
You would just have to search/replace the whole project.

nhibernate interceptors with domain context

Is it possible (in a clean fashion) to create an audit interceptor in hibernate 2.1 and pass in a domain context to it?
What I would like to achieve is to set a Date Time (can be done easy peasy - found loadsa articles after a quick google), but setting an object e.g. a user who created the item, or altered an entity I have yet to find anything which covers this.
Since I will not know the object at application request/start up (which is where i have to register the nhibernate interceptor), does anyone know of a suitable workaround?
Thanks in advance, Mark H
You can store the user in the current session (HttpContext.Session) or use thread local data. It can then be accessed by the listener. If you go for the thread local approach, you will need to set if for each request, for instance with an HttpModule. Not perfect, but that's how I've seen it done in java (not exactly the same, but a similar approach).

Resources