Select to view content in your preferred language

Poll External Website for JSON with variables

4173
1
04-29-2015 03:11 AM
GregGut
Deactivated User

Is it possible to reuse the result of one poll in the following polls? I would like the use the "Poll an External Website for JSON" Input connector with some variables that can be set/reset on a successful poll.

An example would be a LAST_POLLED variable, where in an initial poll we receive a timestamp which can be used in the next poll request? Does the GeoEvent processor support variables, and if yes how do we initiate them, use them in the Poll function such as in the URI or in the header parameters?

Request 1:

LAST_POLLED is null/undefined

myurl/method?param1=1&param2=2&last_poll=[LAST_POLLED] which would result in something like this:

myurl/method?param1=1&param2=2&last_poll

Request 1 comes back with a result including a timestamp, We set LAST_POLL=timestamp1

Request 2

Now LAST_POLL is initiated to timestamp1

myurl/method?param1=1&param2=2&last_poll=[LAST_POLLED] which would result in something like this:

myurl/method?param1=1&param2=2&last_poll=timestamp1

Is this possible? How would we achieve this?

Tags (2)
0 Kudos
1 Reply
RJSunderman
Esri Regular Contributor

Hello Greg -

I do not believe GeoEvent will support what you are trying to do for a couple of reasons.

First, GeoEvent does not provide any sort of node-level cache which you can access.The "nodes" in a GeoEvent Service (inputs, outputs, filters, processors) generally do not cache information from events they receive. Every node handles the GeoEvents it receives independently. There are a few exceptions, but the information being cached in these cases is very specific to the node's function and is not accessible for you to extract or use.

Second, I don't believe there is any syntax for variable substitution built-in to an inbound connector's configuration. If you take a look at my reply to Thread_510827 (which illustrates how to include an event field name in a spatial filtering expression), you'll see that there are a few places within GeoEvent that you can specify ${fieldName} in place of a literal string and GeoEvent will dynamically replace the "macro" ${fieldName} with a value taken from the GeoEvent currently being handled by that node. Because there is no variable substitution syntax built-in to an inbound connector's configuration, whatever text you enter to configure an input must be the literal text value.

I'm trying to think if recommending you explore using the GeoEvent SDK to develop a custom transport would support what you are trying to do. I suppose it would be possible to implement a self-modifying transport which would specify, say, the URL used initially to poll an external server. Then, after data is received from a poll, if the transport can retrieve data values from the adapter, the transport could use one or more of the received data values values to - possibly conditionally - reconfigure itself before the next poll is conducted.

Keep in mind, though, that it is the responsibility of an adapter to take the byte stream from the connector's transport and "adapt" it to create a GeoEvent. You are looking at using the SDK here to develop a custom adapter and transport, functionality found right up front before a GeoEvent is even passed to a GeoEvent Service for filtering / processing ... and I don't know if member variables can be accessed between a transport object's classes an adapter object's classes. The SDK may not even support what you are trying to do.

Hope this information helps -

RJ

0 Kudos