ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Serialise a CSV record into a database column

Post new topic  Reply to topic
 Serialise a CSV record into a database column « View previous topic :: View next topic » 
Author Message
akil
PostPosted: Thu Jun 26, 2014 4:44 am    Post subject: Serialise a CSV record into a database column Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi

We have a DFDL XSD created for an incoming file, we use the FileInput to read the file. The record is then converted to an XML and an API call call is made to a server.
There is also a requirement to log the entire record, in a column of an audit table - column is big enough to hold the record. Is there an easy way to do this via the Mapping Node , or is there any alternate way ?

Regards
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Thu Jun 26, 2014 5:47 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Record and Replay.
Back to top
View user's profile Send private message
akil
PostPosted: Thu Jun 26, 2014 8:42 pm    Post subject: Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi,

Is there any other alternative to Record & Replay ? This is an already available custom built table that's used by many other systems and it needs to be used to store records from the IIB as well.

In the developer studio, we create a logical instance and then serialise the record, is something similar available during runtime? To serialise a record that's already parsed in the JavaComputeNode or equivalent?

Regards
Back to top
View user's profile Send private message Visit poster's website
smdavies99
PostPosted: Thu Jun 26, 2014 9:42 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

There is nothing to stop you from writing your own code that serializes the message and puts it into your own table.

A couple of years ago I had to create a solution where messages were grouped by an identified extracted from within the messages and then later on combine all them into a single message. Yes this was a collector node replacement solution because there could be 1 messages or 20 messages in a collection.
The whole job tool less than two days including deconstructing the collection and creating a composite output message.

the step where you serialize a message and put it into a table is a very useful bit of code to have in your tooklit. I know that mqjeff is a fan of Record/replay but there are many cases where it is not appropriate simply because you have to integrate your solution with existing tables etc.
If you are logging a message like this, the chances of needing to replay it are IMHO (for what it is worth) very small indeed.

The biggest headache I have found is that the DBA's have not planned for the logging DB to get really, really big when you start this up for real. One site decided to restrict our logs to 1 day rater than increase the DB size. The Auditors soon put a stop to that silliness.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
martinb
PostPosted: Fri Jun 27, 2014 1:10 am    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

Quote:
Is there an easy way to do this via the Mapping Node


Yes, the Graphical Data Map provides transforms for Inserting data into a database

Also see Graphical Data Mapping Loyalty Data Warehousing sample
Back to top
View user's profile Send private message
akil
PostPosted: Fri Jun 27, 2014 1:57 am    Post subject: Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

I have used the Mapping done for the DB operations, What I have been able to do is 'map' the input record fields to database table fields via a move or some other transform.

I am however unable to figure out how to use the Mapping Node to get the serialised record so that I can assign it to the appropriate column.

Even for ESQL or Java, I am not sure what function/method to use to serialise the parsed logical record.. Can you point me to the right doc/method?
Back to top
View user's profile Send private message Visit poster's website
martinb
PostPosted: Fri Jun 27, 2014 2:23 am    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

Quote:
I am however unable to figure out how to use the Mapping Node to get the serialised record so that I can assign it to the appropriate column.

Even for ESQL or Java, I am not sure what function/method to use to serialise the parsed logical record


For Java look at
Code:
MbElement.toBitstream()


For ESQL look at
Code:
ASBITSTREAM


The Graphical Data Mapper does not provide a transform to serialise elements.
However you can use a Custom Java transform that enables you to call out to a method taking the MbElement as input and returning the serialised record(s) as abyte array, or string.
Back to top
View user's profile Send private message
akil
PostPosted: Sun Jun 29, 2014 11:27 am    Post subject: Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi

I am not able to figure out how to pass the record tree structure to the ESQL function for use with the ASBITSTREAM function ..

In the XPath expression box, i select $record, but this does not work, since the ROW dataType isn't allowed for ESQL procedures that are used in the map.

The help says that only scalar parameters are supported : http://www-01.ibm.com/support/knowledgecenter/#!/SSMKHH_9.0.0/com.ibm.etools.mft.doc/br28672_.htm .

How do I proceed?
_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
martinb
PostPosted: Sun Jun 29, 2014 2:45 pm    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

You could create a Java method taking the record as a MbElement input param, and return the byte[] from calling MbElement.toBitstream().
Back to top
View user's profile Send private message
akil
PostPosted: Sun Jun 29, 2014 10:37 pm    Post subject: Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi

I add a ESQL compute node in the flow, where I used the ASBITSTREAM , storing the output in the InputLocalEnvironment.Variables folder; created an XSD representing this variable, which I subsequently used in the Mapping Node to cast first and then move the data. This worked.!

I will try the Java method as you mentioned as soon as I can and let you know.

Thank you.
_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Serialise a CSV record into a database column
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.