Object store operations:
Contains, Dual store, Remove, Retrieve, Retrieve all keys, Retrieve and Store, and Store are some of the operations that the object store connector can perform.
- Contains is used to check whether a given key exists in the object store.
- Dual storage stores a value with a key and also a key with a value.
- Remove removes the associated key from the object store.
- Retrieve is being used to collect an object from object store to make it accessible in the Mule Message's specified property scope.
- Retrieving only certain keys will find a list of all the keys throughout the object store.
- Retrieve and Store would be a method for retrieving and storing an object at the same time.
- The term store refers to the act of storing an object in an object store.
Get ahead in your career by learning Mulesoft course through hkrtrainings Mulesoft online training
Types of object Store:
Mule offers 2 kinds of object stores, which are as follows.They are in memory and persistent store.
- In-memory store: This helps to store objects throughout memory while they are running. Objects are usually lost whenever the runtime is terminated.
- Mule stores data in a prolonged store whenever an object store has been expressly provisioned to be consistent. Mule generates an insistent store in the system files by default.
Mulesoft Training Certification
- Master Your Craft
- Lifetime LMS & Faculty Access
- 24/7 online expert support
- Real-world & Project Based Learning
Object store UseCases:
Throughout an authorization request, OAuth returns a token, which must be sent with each request and it has an expiry date (e.g. 2 hours). You can save the username in an object store so another flow or Mule application can use it to give recommendations to the client. An innovative token is produced every two hours and it can be processed throughout the object store.
- It could be used while configuring an invertible filter just until the scope is effective.
- It could be used if configuring a custom component which needs to persist data inside an object store.
- It is useful once encrypting or extracting documents from a Mule flow using the Object Store module.
Installation of object store connector:
You can use the Anypoint Object Store Connector to connect to default in-memory object stores, custom object stores, and persistent object stores. Using this connector, you can create instant connectivity between object stores and simplify object store manipulation in Mule.
Unless the object store connector is not available in the Anypoint Studio Mule palette, it can be downloaded from the Anypoint exchange. You can connect to the Anypoint exchange and install the object store connector from Anypoint Studio. All you have to do is accept the license agreement, and it will ask you to restart Anypoint Studio to finish the installation.
Subscribe to our YouTube channel to get new updates..!
Using an In-Memory Object Store to Implement the Idempotent Filter:
- Configure the HTTP Listener in the message source region.
- Drag the Idempotent Filter into the message processor, then configure the object store by clicking the add button and selecting core:in-memory-store.
- Set the Max Entries, Entry TTL, and Expiration Interval parameters. Finish by clicking the Finish button.
- Ttl denotes the Time-To-Live for stored values in milliseconds. "Max Entries" and "Expiration Interval" are required when using this parameter. You must provide all Entry TTL, Max Entries, and Expiration Interval values, or none at all.
- The expiration interval designates the time between expiration checks in milliseconds.
- The maximum amount of entries is specified by Max Entries.
- Configure the Id Expression and enable the Throw on Unaccepted checkbox.
Using a Persistent Object Store to Implement the Idempotent Filter:
- Configure the HTTP Listener in the message source region.
- Drag the Idempotent Filter into the message processor, then configure the object store by clicking the add button and selecting core:simple-text-file-store.
- Set the Max Entries, Entry TTL, Expiration Interval, and Directory parameters. Finish by clicking the Finish button.
- Configure the Id Expression and enable the Throw on Unaccepted checkbox.
Storing and retrieving custom objects form the objects store:
Now we will go through on how to store custom objects from the object store.
- Customize the HTTP Listener in the message source region. We're anticipating the query parameter here, and we're going to save it in the object store.
- Click and drag the object store into the message processor, and then install the object store connector setup by scrolling the add button.
- The default In-Memory or persistent object store is called Partition.
- The Object Store Reference specifies the spring bean instance of the Object Store.
- Select the Store operation to save the object. Enter the Key and Value Reference (for example, Key=EmployeeID, ValueReference=#[message.inboundPrperties.'http.query.params.ID]).
Retrieving objects:
To retrieve the object from the object store, use the Retrieve operation and enter the key you used during the store operation (i.e. Key=EmployeeID). If the key does not exist, an exception will be thrown.
Conclusion:
Object stores are incredibly helpful when you need to hold an object and connect directly from within or outside of the app. Objects could be kept in memory or on a prolonged file system.
Other Related Blogs:
About Author
Kavya works for HKR Trainings institute as a technical writer with diverse experience in many kinds of technology-related content development. She holds a graduate education in the Computer science and Engineering stream. She has cultivated strong technical skills from reading tech blogs and also doing a lot of research related to content. She manages to write great content in many fields like Programming & Frameworks, Enterprise Integration, Web Development, SAP, and Business Process Management (BPM). Connect her on LinkedIn and Twitter.
Upcoming Mulesoft Training Certification Online classes
Batch starts on 25th Dec 2024 |
|
||
Batch starts on 29th Dec 2024 |
|
||
Batch starts on 2nd Jan 2025 |
|