IBM MDM BusinessProxy CompositeTxn thread safety - master-data-management

Are instance level objects in IBM MDM BusinessProxy/ExternalRules/BehaviorExtension thread safe ?
If 5 threads are invoking a BusinessProxy(BP) via MQ or WebserviceCall or by BatchProcessor,then are 5 BP Objects created newly or is it just a single BP object ?

I did a POC to validate the same. I found that each time a BP is getting called a new BP object is created and hence the instance level objects are always thread safe.

Related

what is the difference between loading dynamic library (which is internally calling COM dll) in main thread and worker thread?

Can any body tell me what is the difference between loading dynamic library (which is internally calling COM dll) in main thread and worker thread.
Thanks in advance
Mostly, due to the support of the application development language, there is little need for special on the main thread to use COM.
For example, check the OLE/COM option with the project creation wizard.
However, when using multiple worker threads and using COM in the worker thread, the following actions are necessary.
Worker threads using COM must initialize OLE at the beginning of the thread (before creating/using COM objects).
For Win32 API, it is CoInitialize()/CoInitializeEx(). Alternatively, depending on the application development language, there will be equivalent functions and libraries, so please call it.
Worker threads that use COM must perform their own message processing loop independently of Windows message processing loop performed by the main thread responsible for UI.
Please pay attention to the COM component being used.
If the value of ThreadingModel in the registry in which the COM component is registered is an empty string (nothing is set), an event may not be notified to the work thread and an exception may be raised.
If there is no value in this registry please write "Apartment".
Please use COM object basically only from the created thread.
If a COM object is called from another thread that is not the thread that created the COM object, an error may occur or normal operation may not be performed.
Additional notes:
In order to terminate the worker thread, it is necessary to perform the above cleaning up.
Terminate and release COM object, stop message processing loop, call CoUnintialize(), and so on.
Resources created/allocated within the worker thread must be terminated/released.

Apache ODE - how do i get the process id after the instance is created?

i have deployed ODE as a web service and my client app is communicating through the ode events. currently to get the instance id, we are capturing the instance create event and querying all the instances to match the correlation. this is not very efficient and as the number of instances increases, this will be a performance hit. what is the best way to get the instance id as soon as the process instance is created by ODE.
second issue with the above approach is that if the next task in the process is also started and the corresponding event is fired by ODE, we do not have a way to associate this task with the process id until we figure out the process id with the first event which may be delayed due to its asynchronous nature?
thanks,
The current process instance is stored in an extension variable called $ode:pid. You can assign this value to a response variable (e.g. to the instantiating request) and use it to initialize a correlation set.
<assign>
<copy>
<from>$ode:pid</from>
<to>$response.part</to>
</copy>
</assign>
should actually do the job.

Prioritize real time msgs over batch msgs using Queues/MDBs

In my application a specific service has a constant bandwidth (For e.g 100 transactions at a time ) , requests to the service arrive real-time as well as batch jobs (Queues). The real time requests doesnt have a uniform distribution. I need a way to make sure that real time jobs are processed first before the batch jobs and also make sure that at any time I don't exceed the threshold of the service.
Please evaluate the following approach.
Have 2 queues A - real time and B - Batch job. Have a thread pool of size = 100 (Service Threshold ) and let the
thread pool first try to pick msgs from A if any else pick from B.
My application runs on Weblogic , I want to make use of MDBs instead of the thread pool but there is no way to make the MDBs listen to multiple Queues.
Within JMS you can set a message priority which should be respected if possible. This may be something simple to try.
Another option could be to set a JMS property on the message with the client and use a Message Selector on the MDB. You could set MY_MESSAGE_TYPE=batch/rt and then have multiple MDB's deployed that are listening to the same queue but can be assigned to different work managers. Keep in mind that Work Manager != Thread Pool. You can also set a Request Class to ensure that if the batch pool is in use that the RT pool will not be starved for threads/CPU.
With this design I believe that if you have two MDB's, one with a message selector, messages that meet the selector criteria should be delivered to the MDB with that selector (RT) before an MDB with no selectors (BATCH). This would be a fairly simple POC to do - set up a client that sends messages to the queue, some of which have the JMS property set to RT and others that do not have it set.
10.0 referece (which is still applicable): http://docs.oracle.com/cd/E11035_01/wls100/config_wls/self_tuned.html

Mule and memory (RAM) usage

i've tried to run mule on 3 cases in order to test it's mem usage:
One case is where i had a quartz generator create an event that a filter (right after it in a flow) allways stopped (Returned false) - meaning the flow did absolutly nothing.
In another case i did not use the filter but just used that flow to send a custom object to a WCF service running on another computer (using a cxf endpoint)
Also, i've checked what happened when i leave the flow as is but drop the wcf servce (meaning a lot of socket connection exceptions were thrown).
I did this because i am building a large app that would need this bus to work at all times (weeks at a time).
In all of those cases, the mem usage kept rising. (getting as high as 200mb ram after a few hours)
Any specific reasons this could happen?? What is causing mule to take more memory, in all of these cases?
Off the top of my head I'll stick with thread pool lazy initialization as explanation for this behavior. As time goes on and usage gets higher, the thread pools will get fully initialized.
If you want proof evidences take a look to this approach, or this one (with enableStatistics).

How do I handle "Receive" calls being made out of order?

I have a WF4 service that emulates a sales funnel. It works by starting with a "Registration" receive call. After that, there are 10 similar stages (comprised of a 2 receives at each stage). You can't advance past a stage until after the current stage validates the data received. What I'm unsure about though is, even though my client app wouldn't allow for it, how can I make my workflow prevent anyone from calling the receive operations out of order? In my test console app, I let the user call any receive operation (just because I wanted to see what happens).
For example, if I call the Register first and then the "AddQualification" receive before the "AddProspect" receive, the test app returns with an exception like this:
Operation 'AddQualification|{http://tempuri.org/}IZSalesFunnelService' on service instance with identifier '1984c927-402b-4fbb-acd4-edfe4f0d8fa4' cannot be performed at this time. Please ensure that the operations are performed in the correct order and that the binding in use provides ordered delivery guarantees
2 things come from this that I don't know how to do:
First, how do I handle the Fault Exception to notify the client in a meaningful way and...
Second, because I'm using persistence (and property promotion), when I make the out of order call, the properties that are promoted unload. They are not promoted again after the client gets the exception.
Any thoughts?
Sorry, my server is playing up a little so the blog keeps going off the air temporarily.
With regard to your second question, you need to make sure that your workflow service is set to Abandon for unhandled exceptions. Here is the doco for AppFabric for this setting:
Abandon. The service host aborts the workflow service instance in memory. The state of the instance in the database remains “Active”. The Workflow Management Service recovers the abandoned workflow instance from last persistence point saved in the persistence database.
Abandon and suspend. The service host aborts the workflow service instance in memory and sets the state of the instance in the persistence database to “Suspended”. A suspended instance can be resumed or terminated later by using IIS Manager. These instances are not recovered by the Workflow Management Service automatically.
Terminate. The service host aborts the workflow service instance in memory, and sets the state of the instance in the persistence database to “Completed (Terminated)”. A terminated instance cannot be resumed later.
Cancel. The service host cancels the workflow service instance causing all the cancellation handlers to be invoked so that a workflow terminates in a graceful manner, and sets the state of the instance in the persistence database to “Completed (Cancelled)”.
Abandon is the only setting that will hold onto your workflow in the persistence store so that you can then call it again.
Hope this helps.
Regarding your first question I'd look at Rory Primroses post on how to shield Content Correlation Failures: Managing Content Correlation Failures. In here he translates an exception into a valid Business Exception.