Setpermission on clustered private MSMQ queue - powershell

I am trying to allocate additional permissions to a private clustered MSMQ queue.
I found How to set permissions on MSMQ Cluster queues? which is the same problem but I can't get it to work.
The key from that article is to set the environment variable:
$env:_CLUSTER_NETWORK_NAME_ = 'myclusterMSMQ'
But what should myclusterMSMQ contain?
In my case I have a cluster MSMQCluster with two nodes MSMQNodeA and MSMQNodeB. The queue is in a clustered resource QueueResource.
The logical to me is to set it to QueueResource, but when I did that, the permission appeared on a queue with the same name on MSMQNodeA... this is where I am running my powershell and it is the resource owner - the queue shouldn't be here but during script testing a queue with that name ended up here too.
My code looks like this:
$queueUser= "domain\svc-account"
$queueName=".\private$\log.queue"
$env:_CLUSTER_NETWORK_NAME_ = "$queueResource"
$queue = New-Object System.Messaging.MessageQueue $queueName
$queue.SetPermissions($queueuser, [System.Messaging.MessageQueueAccessRights]::WriteMessage)
I tried a variation that retrieved the queue using GetPrivateQueuesByMachine($queueResource)
but that gave me the error:
System.Messaging.MessageQueueException (0x80004005): The specified
format name does not support the requested operation. For example, a
direct queue format name cannot be deleted
I am sure that this last method was returning the queue from the QueueResource because when I listed all queues, I didn't get any of the other garbage queues that are on MSMQNodeA.
How do I set additional queue permissions on a private clustered queue with Powershell?

It looks like it wasn't working in part because the service account had lost MSMQ admin permissions so it didn't matter what value I used when testing.
The following is the correct syntax:
$env:_CLUSTER_NETWORK_NAME_ = $QueueResource

Related

Hazelcast IMap Lock not working on kubernetes across different pods

We are using Hazelcast 4 to implement distributed locking across two pods on kuberentes.
We have developed distributed application, two pods of micro service has been created. Both instances are getting auto discovered and forming members.
We are trying to use IMap.lock(key) method to achieve distributed locking across two pods however both pods are acquiring lock at same time, thereby executing the business logic at the concurrently. Also hazelcast management center shows zero locks for the created Imap.
Can you please help on how to achieve synchronization of imap lock(key) so that single pod get the lock for given key at given point of time ?
Code Snippet:-
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
try{
IMap map = client.getMap("customers");
map.lock( key );
//business logic
} finally {
map.unlock( key );
}
}
Can you create an mvce and confirm the version of Hazelcast used please.
There are tests for locks here that you can perhaps use as a way to simplify to determine where the fault lies.

Kogito - wait until data from multiple endpoints is received

I am using Kogito with Quarkus. I have set on drl rule and am using a bpmn configuration. As can be seen below, currently one endpoint is exposed, that starts the process. All needed data is received from the initial request, it is then evaluated and process goes on.
I would like to extend the workflow to have two separate endpoints. One to provide the age of the person and another to provide the name. The process must wait until all needed data is gathered before it proceeds with evaluation.
Has anybody come across a similar solution?
Technically you could use a signal or message to add more data into a process instance before you execute the rules over the entire data, see https://docs.kogito.kie.org/latest/html_single/#ref-bpmn-intermediate-events_kogito-developing-process-services.
In order to do that you need to have some sort of correlation between these events, otherwise, how do you map that event name 1 should be matched to event age 1. If you can keep the process instance id, then the second event can either trigger a rest endpoint to the specific process instance or send it a message via a message broker.
You also have your own custom logic to aggregate the events and only fire a new process instance once your criteria of complete data is met, and there is also plans in Kogito to extend the capabilities of how correlation is done, allowing for instance to use variables of the process as the identifier. For example, if you have person.id as correlation and event to name and age of the same id would signal the same process instance. HOpe this info helps.

Communication with two agents within a single block in Anylogic

As seen below in my flowchart I am trying to model jobs that are being sent to servers. In the service block, my resource pool is servers.
My current model has Agent 'Jobs' being created in the source. they are then sent to the Queue and to the Service block where the Service block will seize a server(Server Agent) from the resource pool.
I have set out my simulation so that servers are deleted at random times.
My trouble is: When a server that is currently working on a Job is deletes (at a random time), how is it possible to send the Job back to the queue.
I'm having an issue getting the service block/server pool accessing the Jobs agent
I'm not sure how you're deleting your servers but if you're doing so by reducing the capacity of the resource pool my answer will work as you desire.
For you to return the job back to queue, first you'll need some changes to your flowchart. (See Image)
Then, in your service block, change your settings to match mine:
And voilá, that's it. If you're using a different type of deletion and this approach doesn't work, let me know.
Cheers,
Luís Pereira

Different types of queues in MSMQ

Can anybody explain the different types of queues provided by MSMQ.
Outgoing, private and system queues , what are the functions of them?
Thanks.
Yash
Private queues are registered on the local computer, not in the directory service, and typically cannot be located by other Message Queuing applications
Private queues are accessible only by Message Queuing applications that know the full path name, the direct format name, or the private format name of the queue
In a domain environment, public queues are queues that are published in Active Directory
A transactional queue is one that only contains transactional messages, which are messages sent within a transaction
http://technet.microsoft.com/en-us/library/cc778799(v=ws.10).aspx

MSMQ multiple readers

This is my proposed architecture. Process A would create items and add it to a queue A on the local machine and I plan to have multiple instances of windows service( running on different machines) reading from this queue A .Each of these windows service would read a set of messages and then process that batch.
What I want to make sure is that a particular message will not get processed multiple times ( by the different windows service). Does MSMQ by default guarantee single delivery?
Should I make the queue transactional? or would a regular queue suffice.
If you need to make sure that the message is delivered only once, you would want to use a transactional queue. However, when a service reads a message from the queue it is removed from the queue and can only be received once.