I 'm looking at the Java client library example file LiveStream.java.
Where I want to get to with this is to be able to create an arbitrary number of definitions, and associate results which come back via their streams with the appropriate definition, so the results can be stored in a database with a key identifying which query led to that data being found. This will of course eventually be automated… but a trivial hardcoded example, starting from the LiveStream.java source file, will demonstrate the workflow I’m describing…
Definition def1 = user.createDefinition("interaction.type == \"twitter\" and (interaction.content contains \"cat\")"); Definition def2 = user.createDefinition("interaction.type == \"twitter\" and (interaction.content contains \"dog\")");
StreamConsumer consumer1 = def1.getConsumer(StreamConsumer.TYPE_HTTP, new LiveStream()); StreamConsumer consumer2 = def2.getConsumer(StreamConsumer.TYPE_HTTP, new LiveStream()); consumer1.consume(); consumer2.consume();
All well and good – data comes back for both, but there’s apparently no way within the onInteraction method, to identify WHICH Definition led to a specific Interaction being returned – so I can’t associate each Interaction with its correct Definition – either ‘cat’ or ‘dog’-based!
All the fields in StreamConsumer are Protected, so I guess they’re not meant to be accessed outside the client library Package – which makes me assume I’m missing the ‘proper’ way to relate Interactions back to their Definitions. My use-case must be a very common one, so please point me at the correct pattern/example.
All help appreciated
and other markup tags don’t seem to work as advertised in your forums?