check lock

Check Lock

Version: 17.07

Supported Since: 17.07

What is an Check Lock Processor?

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.

check lock

Sample Use Case

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.

Prerequisite

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

Implementation

check lock flow

Web Service 1

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.

acquire http ingress connector config

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.

check ackqire lock config

Web Service 2

Add another NIO HTTP Ingress Connector and configure the the request receiving service path and port.

check http ngress connector config

Then add Check Lock processing element and configure the lock path as same as Acquire Lock processing element.

check lock config

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.

acquire string payload setter config