1
votes

Implement cache in TIBCO BW

I need to implement cache/memory in TIBCO BW. Contents of this cache should be available across BW projects.

What I am trying to do is, when I receive a message containing multiple shipment records - (Shipment and delivery No is unique combination)

  1. I need to first check in cache if any of these records exist. If yes - reject whole XML If not, then push this data into cache/memory.

  2. Once this is done then I need to call SOAP request reply to external system.

  3. In Another project, when Acknowledgement is received from external system, I need to check the records in the message, find out those records in cache and delete them.

Is there any way to do this?

Challenge here is there is no unique key for a whole message. Each record with combination of shipment/delivery is unique.

Here is what I tried and challenge in it: 1) I thought of putting the data in a file and naming the file as the requestID/Key for each message. Then in another project, check the file and delete it

But since we dont have key, I cannot do that.

2) Using shared variables: I believe shared variables will not be available across bw projects. So, this option is out

3) third option is to use EMS queue, park the message temporarily there containing records. Then search in this, and if the records match reject the request.

And, in acknowledgement (another project), search for the records in ems message and delete that particular message.

Any help on this would be appreciated.

thanks

2

2 Answers

1
votes

Why don't you use database or file to store the records ? Because when you stop or restart or a problem occured in the appnode, the cache will be erased and you will not be able to retreive the records not treated.

0
votes

4th option is using tibco activity 'Java Global instance' for implementing cache in Java.

"The Java Global Instance shared configuration resource allows you to specify a Java object that can be shared across all process instances in a Java Virtual Machine (JVM). When the process engine is started, an instance of the specified Java class is constructed."

You can google ton's of cache implementation in Java for example https://crunchify.com/how-to-create-a-simple-in-memory-cache-in-java-lightweight-cache/

Regarding your statement: "Challenge here is there is no unique key for a whole message. Each record with combination of shipment/delivery is unique"

So, you do have unique key - combination of shipment/delivery is unique. If record size is not too huge you can use the record as key "as is" or create unique hash for each record and use it as key if key size is an issue.