I want to put PDX like data into a region with GFSH

161 Views Asked by At

In GFSH I want to run a put command to create a key and value with set of PDX like values... For example:

put --key=('test1') --value=('Client':'XYZ', 'MsgType':'R', 'OrdType':'C', 'SecurityType':'FOR', 'Symbol':'EUR/USD', 'QuoteReqId':'test1', 'OrderQty':'100000', 'OrderQty2':'0', 'Reference1':'GFSH Test', 'StreamingQuoteDuration':'30', 'FutSettDate':'20200102', 'Currency':'EUR') --region=/myRegion

This is returning the error

You cannot specify ':'R', 'OrdType':'C', 'SecurityType':'FOR', 'Symbol':'EUR/USD', 'QuoteReqId':'test1', 'OrderQty':'100000', 'OrderQty2':'0', 'Reference1':'GFSH Test', 'StreamingQuoteDuration' :'30', 'FutSettDate':'20200102', 'Currency':'EUR')' as another value for the default ('') option in a single command. You already provided 'MsgType' earlier. Did you forget to add quotes around the value of another option?

2

There are 2 best solutions below

0
rupweb On BEST ANSWER

I tried @Juan Ramos answer above but it did not quite work. The spaces aren't the issue - what makes the initial put work is adding double quotes around the value string in brackets:

put --key=('test1') --value="('Client':'XYZ', 'MsgType':'R', 'OrdType':'C', 'SecurityType':'FOR', 'Symbol':'EUR/USD', 'QuoteReqId':'test1', 'OrderQty':'100000', 'OrderQty2':'0', 'Reference1':'GFSH Test', 'StreamingQuoteDuration':'30', 'FutSettDate':'20200102', 'Currency':'EUR')" --region=/myRegion

That still puts a string in the region and does not make PDX representation of the data though.

1
Juan Ramos On

You basically need to remove all spaces from within the value option, it all works fine once you do that:

gfsh>put --key=('test1') --value=('Client':'XYZ','MsgType':'R','OrdType':'C','SecurityType':'FOR','Symbol':'EUR/USD','QuoteReqId':'test1','OrderQty':'100000','OrderQty2':'0','Reference1':'GFSHTest','StreamingQuoteDuration':'30','FutSettDate':'20200102','Currency':'EUR') --region=/myRegion
Result      : true
Key Class   : java.lang.String
Key         : {'test1'}
Value Class : java.lang.String
Old Value   : null


gfsh>query --query="SELECT * FROM /myRegion"
Result : true
Limit  : 100
Rows   : 1




Result
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{'Client':'XYZ','MsgType':'R','OrdType':'C','SecurityType':'FOR','Symbol':'EUR/USD','QuoteReqId':'test1','OrderQty':'100000','OrderQty2':'0','Reference1':'GFSHTest','StreamingQuoteDuration':'30','FutSettDate':'20200102','Currency':'EUR'}

Cheers.