Sunday, 28 June 2015

Whilst I remember - parsing my JSON in IBM Integration Bus

Following my earlier post: -


I'm writing this down before I forget.

Previously,I'd noticed that my Compute Node was returning JSON in this format: -

message <{"Employee":{"row":{"EMPNO":"000100","FIRSTNME":"THEODORE","LASTNAME":"SPENSER"}}}>

which didn't really tie up with my expectations, given that the DB2 schema is like this: -

Employee
EMPNO
FIRSTNME
LASTNAME

I fiddled around with my ESQL, changing it from this: -

SET OutputRoot.JSON.Data.Employee = rowRef;

to: -

SET OutputRoot.JSON.Data.Employee = dbResultSetRef.row;

In other words, I removed the reference to rowRef and instead replaced it with dbResultSetRef.row.

I now see this: -

message <{"Employee":{"EMPNO":"000100","FIRSTNME":"THEODORE","LASTNAME":"SPENSER"}}>
message <{"Employee":{"EMPNO":"000200","FIRSTNME":"DAVID","LASTNAME":"BROWN"}}>
message <{"Employee":{"EMPNO":"000300","FIRSTNME":"PHILIP","LASTNAME":"SMITH"}}>

from input such as this: -

{"EmployeeID":"000100"}
{"EmployeeID":"000200"}
{"EmployeeID":"000300"}


I also learned about the Trace Node



which returns some tasty debug: -

Jun 28 20:37:54 bpmdemo IIB[77236]: IBM Integration Bus v9002 (IB9NODE.IIB9) [Thread 90570] (Msg 1/1) BIP3051E: Error message '( ['MQROOT' : 0x7f68b80d3e00]   (0x01000000:Name  ):Properties = ( ['MQPROPERTYPARSER' : 0x7f68b803c390]     (0x03000000:NameValue):MessageSet             = NULL     (0x03000000:NameValue):MessageType            = NULL     (0x03000000:NameValue):MessageFormat          = NULL     (0x03000000:NameValue):Encoding               = NULL     (0x03000000:NameValue):CodedCharSetId         = NULL     (0x03000000:NameValue):Transactional          = NULL     (0x03000000:NameValue):Persistence            = NULL     (0x03000000:NameValue):CreationTime           = NULL     (0x03000000:NameValue):ExpirationTime         = NULL     (0x03000000:NameValue):Priority               = NULL     (0x03000000:NameValue):ReplyIdentifier        = NULL     (0x03000000:NameValue):ReplyProtocol          = 'MQ' (CHARACTER)     (0x03000000:NameValue):Topic                  = NULL     (0x03000000:NameValue):ContentType            = NULL     (0x03000000:NameValue):IdentitySourceType     = NULL     (0x03000000:NameValue):IdentitySourceToken    = NULL     (0x03000000:NameValue):IdentitySourcePassword = NULL     (0x03000000:NameValue):IdentitySourceIssuedBy = NULL     (0x03000000:NameValue):IdentityMappedType     = NULL     (0x03000000:NameValue):IdentityMappedToken    = NULL     (0x03000000:NameValue):IdentityMappedPassword = NULL     (0x03000000:NameValue):IdentityMappedIssuedBy = NULL   )   (0x01000000:Object):JSON       = ( ['json' : 0x7f68b81666a0]     (0x01000000:Object):Data = (       (0x01000000:Object):Employee = (         (0x03000000:NameValue):EMPNO    = '000200' (CHARACTER)         (0x03000000:NameValue):FIRSTNME = 'DAVID' (CHARACTER)         (0x03000000:NameValue):LASTNAME = 'BROWN' (CHARACTER)       )     )   ) ) ' from trace node 'employeeService.Trace'. 
Jun 28 20:38:08 bpmdemo IIB[77236]: IBM Integration Bus v9002 (IB9NODE.IIB9) [Thread 90570] (Msg 1/1) BIP3051E: Error message '( ['MQROOT' : 0x7f68b80d3e00]   (0x01000000:Name  ):Properties = ( ['MQPROPERTYPARSER' : 0x7f68b803c390]     (0x03000000:NameValue):MessageSet             = NULL     (0x03000000:NameValue):MessageType            = NULL     (0x03000000:NameValue):MessageFormat          = NULL     (0x03000000:NameValue):Encoding               = NULL     (0x03000000:NameValue):CodedCharSetId         = NULL     (0x03000000:NameValue):Transactional          = NULL     (0x03000000:NameValue):Persistence            = NULL     (0x03000000:NameValue):CreationTime           = NULL     (0x03000000:NameValue):ExpirationTime         = NULL     (0x03000000:NameValue):Priority               = NULL     (0x03000000:NameValue):ReplyIdentifier        = NULL     (0x03000000:NameValue):ReplyProtocol          = 'MQ' (CHARACTER)     (0x03000000:NameValue):Topic                  = NULL     (0x03000000:NameValue):ContentType            = NULL     (0x03000000:NameValue):IdentitySourceType     = NULL     (0x03000000:NameValue):IdentitySourceToken    = NULL     (0x03000000:NameValue):IdentitySourcePassword = NULL     (0x03000000:NameValue):IdentitySourceIssuedBy = NULL     (0x03000000:NameValue):IdentityMappedType     = NULL     (0x03000000:NameValue):IdentityMappedToken    = NULL     (0x03000000:NameValue):IdentityMappedPassword = NULL     (0x03000000:NameValue):IdentityMappedIssuedBy = NULL   )   (0x01000000:Object):JSON       = ( ['json' : 0x7f68b81666a0]     (0x01000000:Object):Data = (       (0x01000000:Object):Employee = (         (0x03000000:NameValue):EMPNO    = '000300' (CHARACTER)         (0x03000000:NameValue):FIRSTNME = 'PHILIP' (CHARACTER)         (0x03000000:NameValue):LASTNAME = 'SMITH' (CHARACTER)       )     )   ) ) ' from trace node 'employeeService.Trace'. 




No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...