Let me try and explain it a little better..
This is just an example to help understand what I am trying to do.
Lets say there is cars out on the road and they will send ASCII messages to my B4J app by TCP.
Each car has a unique ID.
Car 1 unique ID = Bob
Car 2 unique ID = Tom
Car 3 unique ID = Bill
There could 100,000 - 200,000+ cars.
Each car will send a message to the B4J app every 30 seconds.
For Example:
Bob/testing1
Bob = Car 1 unique ID
testing1 = command from the car (this command will change each time the message is sent)
When my B4J app gets this command above, it needs to trigger the rule in my B4J app. (more on setting this rule/trigger below)
My B4A/B4i app will allow the user to set rules/triggers on the B4J app using a ASCII message.
For Example, if the B4J/B4i app sends:
Bob/----/testing1
It needs to be able to store that command in the B4J app.
In the above example:
Bob = Car 1 unique ID
---- = Time (this was not set in the example)
testing1 = Command
How does the server trigger an event?
Each time the car sends the message it will trigger the rules on the B4J app.
When the car sends the message the rule section in the B4J app will need to run and check if the command is in the list.
So, for example if the message received from the car is
Bob/testing1 and the command testing1 is the list set by the B4A/B4i app then write the message to the log.
Another Example, if the B4J/B4i app sends:
Bob/1430/testing2
It needs to be able to store that command in the B4J app.
In the above example:
Bob = Car 1 unique ID
1430 = Time (14:30)
testing2 = Command
The second example would need to trigger automatically at 14:30 and would need to log the message testing2.
So, I need help with the storing of these rules/triggers which the B4A/B4i sends. Need them stored so if I reset the app they are still there, and the automatic rules (like the second example) start again at the required time.
I was thinking of storing them in a map, but if the B4J app is reset then the map is cleared, so this is not the best way.
I then thought of using a SQL database to store the commands which the B4A/B4i sends and then use a SQL command every time a car sends the message, but not sure if this is the best way or not. But then I am stuck trying to work out how to start the automatic triggers like in the second example when I start the B4J app.
(Hopefully this makes more sense on what I am trying to do.)