Author |
Message
|
mrkumar |
Posted: Sun Aug 07, 2016 10:23 am Post subject: Regarding Graphical mapping node Cache |
|
|
Novice
Joined: 02 Jul 2016 Posts: 18
|
I have ready the cache using graphical mapping node from the article
https://developer.ibm.com/integration/blog/2015/11/16/graphical-data-mapping-with-global-cache/
This is really helpful. however i found that the value of the cache can be only a primitive data type it seems. where as i want to cache an OBJECT like either XML/JSON type.
is this even feasible ? how can I cache an object in graphical mapping node ?
Please advice, I really appreciate your inputs _________________ If you fail, call it as Version1.0 |
|
Back to top |
|
|
timber |
Posted: Sun Aug 07, 2016 2:48 pm Post subject: |
|
|
Grand Master
Joined: 25 Aug 2015 Posts: 1290
|
A serialized Java object is a byte array. A byte array can be put into the global cache. Watch out for classloader issues. |
|
Back to top |
|
|
mqjeff |
Posted: Mon Aug 08, 2016 3:56 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
A serialized message tree is a byte string...
I forget how to do ASBITSTREAM in a mapping node. _________________ chmod -R ugo-wx / |
|
Back to top |
|
|
mrkumar |
Posted: Mon Aug 08, 2016 10:43 am Post subject: |
|
|
Novice
Joined: 02 Jul 2016 Posts: 18
|
timber wrote: |
A serialized Java object is a byte array. A byte array can be put into the global cache. Watch out for classloader issues. |
thanks timber,
would it be safer to go for an approach that is non graphical mapping node ?
can you please share your thoughts to overcome a cache strategy where I can specify the life time of the cache ?
i was reading about esql cache but i didnt find an option to specify the life time of the cache ? you know like once a day or once a month something like that since i get Feed of data once a day so far that I am aware of. _________________ If you fail, call it as Version1.0 |
|
Back to top |
|
|
mrkumar |
Posted: Mon Aug 08, 2016 2:35 pm Post subject: |
|
|
Novice
Joined: 02 Jul 2016 Posts: 18
|
mqjeff wrote: |
A serialized message tree is a byte string...
I forget how to do ASBITSTREAM in a mapping node. |
you mean save the value of the cache as string by using ASBITSTREAM function ? _________________ If you fail, call it as Version1.0 |
|
Back to top |
|
|
mqjeff |
Posted: Tue Aug 09, 2016 3:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
mrkumar wrote: |
mqjeff wrote: |
A serialized message tree is a byte string...
I forget how to do ASBITSTREAM in a mapping node. |
you mean save the value of the cache as string by using ASBITSTREAM function ? |
No. I meant that you could save the message tree into the cache using ASBITSTREAM. Not saying you *should*, just that you *can*.
Also, there isn't really an "object" in the graphical mapping node. There's two message trees and a set of transformations between them. Some of those transformations could be Java procedures, which would have objects.
But without a Java transformation, you're only working with message trees (or portions thereof).
If you don't see features available in the global cache to do data management functions - like set a lifetime and expire data and/or reload it.... Then those functions aren't available.
You can file a Request For Enhancement. You can implement your own tools to do the data management functions. You can use some other solution than a cache. _________________ chmod -R ugo-wx / |
|
Back to top |
|
|
martinb |
Posted: Wed Aug 10, 2016 11:22 pm Post subject: |
|
|
Master
Joined: 09 Nov 2006 Posts: 210 Location: UK
|
Hi
If you feel the lack of support for storing complex elements, sub trees etc into the Global Cache from a Graphical Mapping node is limiting, I'd suggest raising an RFE.
As noted another approach could be to store a serialized (String) representation of your complex type into the Cache. The advantage of using String rather than some custom Java object is that you don't have to be concerned about ensuring the object's class is resolvable.
One approach that is present here is based on using JAXB. That post is using the Java Compute node, but I guess you could provide a Java method that would be usable in a Mapper Custom Java Transform.
An approach I have used when only needing a few fields to be cache'd is to simply combine then with XPath "fn:concat" on the Put and use "fn:tokenize" in the Get. |
|
Back to top |
|
|
harish_td |
Posted: Sat Aug 13, 2016 11:04 pm Post subject: |
|
|
Master
Joined: 13 Feb 2006 Posts: 236
|
|
Back to top |
|
|
martinb |
Posted: Mon Aug 15, 2016 1:16 am Post subject: |
|
|
Master
Joined: 09 Nov 2006 Posts: 210 Location: UK
|
The TimeToLive can also be set in the Graphical Data Map Cache Put transform |
|
Back to top |
|
|
|