Hazelcast API¶
The Hazelcast API provides a set of operations for managing distributed data structures such as lists, sets, queues, maps, and ring buffers. It allows users to interact with these data structures programmatically in a distributed environment.
Why Integrate Hazelcast with EasyTask?¶
Integrating Hazelcast with EasyTask enables you to automate distributed in-memory data management workflows. This integration allows you to:
- Manage Distributed Data Structures: Automate operations on lists, sets, queues, maps, and ring buffers across your Hazelcast cluster through EasyTask orchestration.
- Scale Data Processing: Leverage Hazelcast's in-memory data grid to handle high-throughput data operations as part of your automated EasyTask workflows.
- Streamline Cluster Operations: Connect to Hazelcast clusters, manage distributed collections, and shutdown connections programmatically without manual intervention.
Required Values in Vault¶
Example Usage¶
curl -X POST http://localhost:8008/run-integration \
-H "Content-Type: application/json" \
-d '{
"is_credentials": {
"userid": "test",
"passwd": "test123"
},
"integration": "hazelcast",
"uuid": "ae0e8ba9-423a-410e-bba5-e1933ff868c5",
"init": {
"vault_path_key": "hazelcast/secret"
},
"action": [
{
"add_to_list": {
"list_name": "json_list",
"item": 1
}
}
]
}'
Functions¶
List Operations¶
add_to_list¶
add_to_list: This function adds an item to a list.
add_all_to_list¶
add_all_to_list: This function adds multiple items to a list.
add_at_to_list¶
add_at_to_list: This function adds an item to a list at a specific index.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| list_name | str | Name of the list | yes |
| index | int | Index at which to add the item | yes |
| item | any | Item to add to the list | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the item was added successfully |
add_all_at_list¶
add_all_at_list: This function adds multiple items to a list at a specific index.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| list_name | str | Name of the list | yes |
| index | int | Index at which to add the items | yes |
| items | list | List of items to add | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if all items were added successfully |
get_from_list¶
get_from_list: This function retrieves an item from a list at a specific index.
get_all_from_list¶
get_all_from_list: This function retrieves all items from a list.
get_sub_list¶
get_sub_list: This function retrieves a sublist from a list.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| list_name | str | Name of the list | yes |
| from_index | int | Start index of the sublist | yes |
| to_index | int | End index of the sublist | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | list | Sublist of items |
first_index_in_list¶
first_index_in_list: This function finds the first index of an item in a list.
last_index_in_list¶
last_index_in_list: This function finds the last index of an item in a list.
is_value_in_list¶
is_value_in_list: This function checks if a value is in a list.
is_all_value_in_list¶
is_all_value_in_list: This function checks if all specified values are in a list.
replace_in_list¶
replace_in_list: This function replaces an item at a specific index in a list.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| list_name | str | Name of the list | yes |
| index | int | Index of the item to replace | yes |
| item | any | New item to put at the index | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | any | The previous item at the index |
retain_all_in_list¶
retain_all_in_list: This function retains only the specified items in a list.
remove_from_list¶
remove_from_list: This function removes the first occurrence of an item from a list.
remove_at_from_list¶
remove_at_from_list: This function removes an item at a specific index from a list.
remove_all_from_list¶
remove_all_from_list: This function removes all occurrences of specified items from a list.
Set Operations¶
add_to_set¶
add_to_set: This function adds an item to a set.
add_all_to_set¶
add_all_to_set: This function adds multiple items to a set.
get_all_from_set¶
get_all_from_set: This function retrieves all items from a set.
is_value_in_set¶
is_value_in_set: This function checks if a value is in a set.
is_all_value_in_set¶
is_all_value_in_set: This function checks if all specified values are in a set.
retain_all_in_set¶
retain_all_in_set: This function retains only the specified items in a set.
remove_from_set¶
remove_from_set: This function removes an item from a set.
remove_all_from_set¶
remove_all_from_set: This function removes all occurrences of specified items from a set.
Queue Operations¶
add_to_queue¶
add_to_queue: This function adds an item to a queue.
add_all_to_queue¶
add_all_to_queue: This function adds multiple items to a queue.
get_all_from_queue¶
get_all_from_queue: This function retrieves all items from a queue.
put_in_queue¶
put_in_queue: This function puts an item into a queue.
is_value_in_queue¶
is_value_in_queue: This function checks if a value is in a queue.
is_all_value_in_queue¶
is_all_value_in_queue: This function checks if all specified values are in a queue.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| queue_name | str | Name of the queue | yes |
| items | list | List of items to check | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if all items are in the queue, False otherwise |
retain_all_in_queue¶
retain_all_in_queue: This function retains only the specified items in a queue.
remove_from_queue¶
remove_from_queue: This function removes an item from a queue.
remove_all_from_queue¶
remove_all_from_queue: This function removes all occurrences of specified items from a queue.
offer¶
offer: This function offers an item to a queue.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| queue_name | str | Name of the queue | yes |
| item | any | Item to offer to the queue | yes |
| timeout | int | Timeout in milliseconds | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the item was offered successfully |
poll¶
poll: This function retrieves and removes the head of a queue.
peek¶
peek: This function retrieves, but does not remove, the head of a queue.
take¶
take: This function retrieves and removes the head of a queue, waiting if necessary until an element becomes available.
rem_cap_queue¶
rem_cap_queue: This function retrieves the remaining capacity of a queue.
Ring Buffer Operations¶
add_to_rbuf¶
add_to_rbuf: This function adds an item to a ring buffer.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| buf_name | str | Name of the ring buffer | yes |
| item | any | Item to add to the ring buffer | yes |
| overflow_policy | int | Overflow policy (0-4) | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | int | The sequence of the added item |
add_all_to_rbuf¶
add_all_to_rbuf: This function adds multiple items to a ring buffer.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| buf_name | str | Name of the ring buffer | yes |
| items | list | List of items to add | yes |
| overflow_policy | int | Overflow policy (0-4) | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | int | The sequence of the last added item |
capacity_rbuf¶
capacity_rbuf: This function retrieves the capacity of a ring buffer.
tail_sequence¶
tail_sequence: This function retrieves the tail sequence of a ring buffer.
head_sequence¶
head_sequence: This function retrieves the head sequence of a ring buffer.
rem_cap_rbuf¶
rem_cap_rbuf: This function retrieves the remaining capacity of a ring buffer.
read_one_from_rbuf¶
read_one_from_rbuf: This function reads one item from a ring buffer at a specific sequence.
read_many_from_rbuf¶
read_many_from_rbuf: This function reads multiple items from a ring buffer.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| buf_name | str | Name of the ring buffer | yes |
| start_sequence | int | Starting sequence number | yes |
| min_count | int | Minimum number of items to read | yes |
| max_count | int | Maximum number of items to read | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | list | List of items read from the ring buffer |
destory_rbuf¶
destory_rbuf: This function destroys a ring buffer.
Map Operations¶
put_in_map¶
put_in_map: This function puts a key-value pair into a map.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the map | yes |
| key | str | Key to insert | yes |
| value | any | Value to insert | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | any | The previous value associated with the key, or null if there was no mapping for the key |
put_all_in_map¶
put_all_in_map: This function puts multiple key-value pairs into a map.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the map | yes |
| map | dict | Dictionary of key-value pairs to insert | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the operation was successful |
is_value_in_map¶
is_value_in_map: This function checks if a value is in a map.
is_key_in_map¶
is_key_in_map: This function checks if a key is in a map.
replace_in_map¶
replace_in_map: This function replaces the value for a given key in a map.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the map | yes |
| key | str | Key to replace | yes |
| value | any | New value | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | any | The previous value associated with the key, or null if there was no mapping for the key |
replace_if_same_in_map¶
replace_if_same_in_map: This function replaces the value for a given key in a map if the current value matches the expected value.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the map | yes |
| key | str | Key to replace | yes |
| old_value | any | Expected current value | yes |
| new_value | any | New value | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the value was replaced, False otherwise |
get_map¶
get_map: This function gets the value for a given key from a map.
get_all_tuples_map¶
get_all_tuples_map: This function gets all key-value pairs from a map.
get_key_list_map¶
get_key_list_map: This function gets all keys from a map.
get_value_list_map¶
get_value_list_map: This function gets all values from a map.
remove_from_map¶
remove_from_map: This function removes a key-value pair from a map.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the map | yes |
| key | str | Key to remove | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | any | The previous value associated with the key, or null if there was no mapping for the key |
remove_if_same_from_map¶
remove_if_same_from_map: This function removes a key-value pair from a map if the current value matches the expected value.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the map | yes |
| key | str | Key to remove | yes |
| value | any | Expected value | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the entry was removed, False otherwise |
delete_from_map¶
delete_from_map: This function deletes a key-value pair from a map.
evict_from_map¶
evict_from_map: This function evicts a key-value pair from a map.
evict_all_map¶
evict_all_map: This function evicts all entries from a map.
get_all_map¶
get_all_map: This function gets multiple entries from a map.
set_in_map¶
set_in_map: This function sets a value for a key in a map without returning the old value.
lock_in_map¶
lock_in_map: This function acquires the lock for the specified key in a map.
is_locked_in_map¶
is_locked_in_map: This function checks if the lock for the specified key in a map is locked.
unlock_in_map¶
unlock_in_map: This function releases the lock for the specified key in a map.
MultiMap Operations¶
put_in_mmap¶
put_in_mmap: This function puts a key-value pair into a multimap.
is_value_in_mmap¶
is_value_in_mmap: This function checks if a value is in a multimap.
is_key_in_mmap¶
is_key_in_mmap: This function checks if a key is in a multimap.
get_mmap¶
get_mmap: This function gets all values associated with a key from a multimap.
get_all_tuples_mmap¶
get_all_tuples_mmap: This function gets all key-value pairs from a multimap.
get_key_list_mmap¶
get_key_list_mmap: This function gets all keys from a multimap.
get_value_list_mmap¶
get_value_list_mmap: This function gets all values from a multimap.
remove_from_mmap¶
remove_from_mmap: This function removes a key-value pair from a multimap.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the multimap | yes |
| key | str | Key to remove | yes |
| value | any | Value to remove | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the entry was removed, False otherwise |
remove_all_mmap¶
remove_all_mmap: This function removes all values associated with a key from a multimap.
is_entry_in_mmap¶
is_entry_in_mmap: This function checks if a key-value pair exists in a multimap.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the multimap | yes |
| key | str | Key to check | yes |
| value | any | Value to check | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the entry exists, False otherwise |
lock_in_mmap¶
lock_in_mmap: This function acquires the lock for the specified key in a multimap.
is_locked_in_mmap¶
is_locked_in_mmap: This function checks if the lock for the specified key in a multimap is locked.
unlock_in_mmap¶
unlock_in_mmap: This function releases the lock for the specified key in a multimap.
value_count_in_mmap¶
value_count_in_mmap: This function gets the number of values associated with a key in a multimap.
put_in_rmap¶
put_in_rmap: This function puts a key-value pair into a replicated map.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the replicated map | yes |
| key | str | Key to insert | yes |
| value | any | Value to insert | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | any | The previous value associated with the key, or null if there was no mapping for the key |
put_all_in_rmap¶
put_all_in_rmap: This function puts multiple key-value pairs into a replicated map.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the replicated map | yes |
| source | dict | Dictionary of key-value pairs to insert | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the operation was successful |
is_value_in_rmap¶
is_value_in_rmap: This function checks if a value is in a replicated map.
is_key_in_rmap¶
is_key_in_rmap: This function checks if a key is in a replicated map.
get_rmap¶
get_rmap: This function gets the value for a given key from a replicated map.
get_all_tuples_rmap¶
get_all_tuples_rmap: This function gets all key-value pairs from a replicated map.
get_key_list_rmap¶
get_key_list_rmap: This function gets all keys from a replicated map.
get_value_list_rmap¶
get_value_list_rmap: This function gets all values from a replicated map.
remove_from_rmap¶
remove_from_rmap: This function removes a key-value pair from a replicated map.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| map_name | str | Name of the replicated map | yes |
| key | str | Key to remove | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | any | The previous value associated with the key, or null if there was no mapping for the key |
size¶
size: This function returns the size of a data structure.
clear¶
clear: This function clears all elements from a data structure.
is_empty¶
is_empty: This function checks if a data structure is empty.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| ds_type | str | Type of data structure (e.g., "LIST") | yes |
| ds_name | str | Name of the data structure | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the data structure is empty, False otherwise |
shutdown¶
shutdown: This function shuts down the Hazelcast client.
Frequently Asked Questions¶
How do I configure Hazelcast credentials in EasyTask?¶
Use the EasyTask vault system to securely store your Hazelcast cluster connection details. Navigate to the integration configuration page and add your cluster member addresses under a vault key like hazelcast/secret.
Can I use Hazelcast with both EasyTask Cloud and On-Premises?¶
Yes, Hazelcast works seamlessly with both EasyTask Cloud and On-Premises deployments. The configuration process is identical.
How do I troubleshoot Hazelcast connection issues?¶
Check the integration server logs in EasyTask for detailed error messages. Verify your cluster member addresses in the vault, ensure the Hazelcast cluster nodes are accessible from the integration server, and test connectivity using the built-in connection test feature.