For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
5 1 0 3

Websockets posting results in error "F5: Source application did not respond. Insert request timeout. Please retry."

Post message using websockets with local TREP is well formed (identical to examples), but I instead of Ack I get an error "F5: Source application did not respond. Insert request timeout. Please retry." I'm able to retrieve the record from the service (DTS), but posting fails. What could be the reason?

treprdp-apiwebsocketsrrtoposting
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

10 Answers

Upvotes
Accepted
11.5k 16 7 10

Hello @pj.chan

Like @Gurpreet. suggestion, you JSON OMM Post message does not include the ID attribute to identify whether the post is On-Stream or Off-Stream post. You can see an example of Posting in market_price_posting.py file (any example with name *Post* based on your prefer complier).

The Off-Steam Post means you send the post message in the Login stream. You need to set the post message's ID to be the same as your login message and set the Post item name and service name.

Example:

Login:

{
	'ID': 1,
	'Domain': 'Login',
	'Key': {
		'Name': 'user',
		'Elements': {
			'ApplicationId': '112',
			'Position': '127.0.0.1/net'
		}
	}
}

Post message:

{
	'ID': 1,
	'Type':'Post',
	'Domain':'MarketPrice',
	'Ack':True,
	'PostID':1,
	'PostUserInfo': {
		'Address': '172.20.110.92'
		'UserID':14736
	},
	'Key':{
		'Name':'POST.DATA', 
		'Service': 'POST_SERVICE'
	},
	'Message': {
		'ID': 0,
		'Type':'Update',
		'Domain':'MarketPrice',
		'Fields':{'BID':45.55,'BIDSIZE':18,'ASK':45.57,'ASKSIZE':19}
	}
}

The On-Stream Post means you send the post message in data stream you have subscribed. You need to set the post message's ID to be the same as your item request message. The post item name and service will be same as item that you have subscribed.

Example:

Item request:

{'ID': 3, 'Key': {'Name': 'POST.DATA', 'Service': 'POST_SERVICE'}}

Post message:

{
	'ID': 3,
	'Type':'Post',
	'Domain':'MarketPrice',
	'Ack':True,
	'PostID':1,
	'PostUserInfo': {
		'Address': '172.20.110.92'
		'UserID':14736
	},
	'Message': {
		'ID': 0,
		'Type':'Update',
		'Domain':'MarketPrice',
		'Fields':{'BID':45.55,'BIDSIZE':18,'ASK':45.57,'ASKSIZE':19}
	}
}
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
11.5k 16 7 10

Hello @pj.chan

This message is generated from the TREP level. Could you please share your JSON Post message? Which type of Posting (On-Stream - via Item request stream id, Off-Stream - via Login stream id) that the application is using?

You may find more detail regarding the OMM Posting with ATS via the following articles:

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
5 1 0 3

Hi @Wasin Waeosri, thanks for your response and useful links. The json for the post was pretty much identical to what I saw in examples provided:

{"Domain":"MarketPrice","Ack":true,"PostID":1,"PostUserInfo":{"Address":"172.20.110.92","UserID":14736},"Message":{"ID":0,"Type":"Update","Domain":"MarketPrice","Fields":{"BID":10.0}},"Type":"Post","ID":2}

I didn't see the StreamId in the samples. The value assigned to ID was the same ID send with the subscription request.

I'll check those links you shared and see if that gives me better clues than the samples. Or grateful if you can provide other advice.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13k 32 12 18

@pj.chan Is it an on or off stream posting. For on stream posting, you will need the stream ID as the ID for the post. For off stream posting you will need the item name and service in the Key object.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
5 1 0 3

Thanks @Gurpreet. and @Wasin Waeosri, if you see my (not very nicely formatted) JSON, the ID is the last element ("ID":2), and 2 was the ID of the request. My fields are not in the same order as yours, but I believe are all there. Below a slightly better formatted version

{
	"Domain":"MarketPrice",
	"Ack":true,
	"PostID":1,
	"PostUserInfo":{
		"Address":"172.20.110.92",
		"UserID":14736
	},
	"Message":{
		"ID":0,
		"Type":"Update",
		"Domain":"MarketPrice",
		"Fields":{"BID":10.0}
	},
	"Type":"Post",
	"ID":2
}

I think the double quotes would be a result of my logging rather than the serialisation.

Does it matter if the request was for snapshot or streaming? (it was streaming in our case).

I didn't try posting in the login stream, but I will

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13k 32 12 18

The order of the fields isn't important in JSON. A few basic questions before we dig in:

1. Are you allowed to post?

2. What is your infrastructure setup (ADS, ?, ?)

3. Is it setup for on stream or off stream posting?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
5 1 0 3

Another app is publishing via RFA to the same record using the same user name, so I imagine we are allowed to post (unless authorisation to post is separate for each API).

I'm not completely familiar with the infrastructure (it is a client site), but they must have ADS and DTS (we are posting to DTS). I wasn't aware that the platform needs to be setup specifically for on stream or off stream (if that's what you mean). I need to check what kind of posting is being done via RFA.

We were trying (and failing) on stream posting, so I will try off stream and see if that works.

Thanks!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
11.5k 16 7 10

Hello @pj.chan

Question: Does it matter if the request was for snapshot or streaming? (it was streaming in our case).

Answer: The item request before post request should be a streaming. The snapshot request will close it stream immediately, so you cannot use its stream to post data.

Did you subscribe to the post item before you send the post message?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
5 1 0 3

Hi @Wasin Waeosri

Yes, I subscribed to the item before posting (with streaming). I haven't had a chance to test off stream posting, but I will do in the next couple of days.

Regards

Pedro

ReRegards

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
11.5k 16 7 10

Hello @pj.chan

Do you have any updates? Can you Off-Stream post data?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Hi @Wasin Waeosri, yes, we were able to post off-stream, so I guess TREP was permissioned for that and not for on-stream? Apologies for not posting an update earlier.

Hello @pj.chan, glade to hear that. Does that TREP server is the same instance that accept your RFA on-stream post? Do your websocket and RFA applications send the post message to the same TREP at the same time?

Click below to post an Idea Post Idea