Version: 17.07
Supported Since: 17.07
Check Lock processing element can be used to check whether a lock has been acquired from currently running UltraESB-X instance. Depending on the environment, scope of the lock you obtain from this processing element may vary. If you use this processing element in a clustered environment, you will get the status of a cluster lock. If you use this in a non clustered environment, you will get the status of a process level lock which only lives inside your running UltraESB-X process.
In order to use this processing element, you must first select the Cluster Management dependency from the processor list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the Cluster Management dependency. |
In the following use case, the requirement is to create two web services. First one will accept http requests and acquire a lock for a given lock path. Second web service will accpet http requests and check whether above mentioned lock has been already acquired. Depending on the output of check, payload is set as distinct string values and sent as the response.
In order to implement above use case you must first select following dependencies when you are creating an empty Ultra project
HTTP NIO Connector from the connector list.
Clustering Manager Processors and Payload Manipulation Processors dependency from the processor list.
If you have already created a project, you can add above dependencies via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list and Processors list, select above dependencies
To implement above use case, first let’s create our integration flow named “integrate-for-acquire-lock-data". Then add an NIO HTTP Ingress Connector and configure the request receiving service path and port.
Then Acquire Lock processing element should be added to acquire lock to access the file from server. From the property pane, a lock path for the lock that is entered.
Add another NIO HTTP Ingress Connector and configure the the request receiving service path and port.
Then add Check Lock processing element and configure the lock path as same as Acquire Lock processing element.
Add two String Payload Setter processing elements to two Out Ports of Check Lock processing elements and configure two distinct strings. Output of both processing elements should be mapped to response path of the NIO HTTP Ingress Connector.
Now run your integration flow and send a request message to Web Service 2 and you will receive the payload as the string value that is configured in Not Acquired path of the Check Lock processing element. Then send a request to Web Service 1 to acquire the lock. Again send a request to Web Service 2 and now you will receive the payload as the string value that is configured in Acquired path of the Check Lock processing element
Acquired |
Message will be emitted from this port if the lock with given path is already acquired by current process |
Not Acquired |
Message will be emitted from this port if the lock with given path is not acquired by current process |
On Exception |
The message context will be sent to this outport if any exception occurred while checking the status of the lock with given name |