API autodiscovery in Mule 4 for multiple flows - mule4

i have 2 flows in my application and when i try to create API autodiscovery policy , we can only choose any one flow from drop down. How can we create API autodiscovery for both flows. Do we need to create 2 autodiscovery config each for one flow?
Thanks,

Using more than one autodiscovery configuration per API is just not supported.

APTToolkit router should be used in this case which i was not using.

Related

How to add AssemblyVersion to every XRay trace as Annotation for both Lambda function and Web APIs

I would like to add the assembly version to every AWS Xray trace as an annotation for both asp.net core web apis and lambda projects. I want this to be added globally for every request/invocation. How can this be achieved?
I believe this would be two code parts: 1 for lambda, and another for Web API. I imagine the WebAPI would need to have it contained within somewhere in startup.cs middleware, but what about lambda?
For WebAPI, you'll need to initialize an instance of AWSXRayRecorder in your request path. Then you can use AWSXRayRecorder.Instance.AddAnnotation("key", "value") to add an annotation to the segment of any request that flows through that path. My guess it that you'll need to do this in the controllers rather than the startup.cs since middleware is only registered during application start.
For lambda it's a bit tricky. Since you cannot add annotation/metadata to the auto-created segment, you'll need to manually create a subsegment, fetch the subsegment from the context, and use subsegment.AddAnnotation("key", "value") to add annotation to the subsegment

Mask sensitive data in Mule4 before logging

I have already gone through the below link to mask/hide/encrypt sensitive data before logging but unable to do so using Mule4. Can someone please share if implemented or suggestions?
http://bushorn.com/encrypting-a-json-element/
The link is no longer available. I'll assume it is a method base on some log4j2 interception that will not work on Mule 4. What you can do is create a custom logging component with the Mule SDK and apply the same logic there, avoiding trying to intercept Mule 4 logging.

Tracing Telemetry in Application Insights across different layers

I'm currently using App insights for logging exceptions and tracing.
My project is Asp.net MVC based and I've 3 different layers. One is front end (MVC with angular) and rest two are Web API service layers.
I've default telemetry logging enabled for all the 3 layers and it is logging all the operations.My problem is that I'm not able to correlate the operation on all the 3 layers. How can I achieve this. I've read that one option is to set the custom property (userID in session) on Telemetry Initializer , but I don't have that information on my Web API layers as they are stateless.
One solution I can think about:
You can generate an internal identifier (e.g. a GUID) for each operation in your MVC layer, add it as a custom parameter (using the Telemetry Initializer) and pass that same ID to the Web API layers for each API call you make. For every telemetry event these Web API layers send, add the identifier as a custom parameter in the same fashion as above.
This way you will be able to correlate the events based on your internal ID.
Besides the already mentioned alternatives, there's already partial support for this built into AI through the ParentOperationId and OperationId context fields. However, there's nothing in place right now that can propagate the fields through Http calls automatically.
It should be possible to have your code add the necessary headers when making outgoing HTTP calls and if you use the right ones, and the other side has the necessary telemetry initializers, it should be better.

Add another Contract Model to WorkFlow Service

I have two work flow that be hosted through WorkflowServiceHost and those contain some Receive activity that expose services to out.
some services that my workflowservices must expose is general, for example suppose there is a monitorring service that return Tracking Information about one wf instance.
Solution 1 : in any workflow definition there is a receive activity that return Tracking Information.
but i look for another solution without defining this functionality as activity.
notice that i dont want use another service to expose these functionality, i want expose these functionality in same work flow service
Tanks
(sorry for bad english writing)
If you want to expose everything as one service you have 2 options:
Add the tracking requests to the workflow service as you suggest
Create a wrapper service, a regular WCF .svc file, and forward the requests to the workflow as needed and handle the tracking outside of the workflow.
If you really want to expose just a single external service I would go for the second option. That said, I normally just expose 2 services as they are different things and services are for machine consumption and not human consumption so the 2 URL's are no problem.

structuring of web services

Consider 3 modules/classes in an ASP.NET Webforms application.
I need a web service for each of them, where each web service contains only one function.
Should I group them into one web service class, or should I keep the one web service for each class?
If they are related and need to be exposed for consumtion by a single client you could create one webservice and call this an API. This means you and your client maintain/consume a single webservice.
If they are clearly unrelated, separate them.
Group them in one class (the base webservice class). If it's needed you can branch from here and instantiate more complicated classes, or even call external libraries (for example if you have a data layer to call)

Resources