Hi,
I am trying to work out how to do a server based triggers and macros.
I understand I can write a IF statement but I need to do this dynamically, so I can't hard code the IF statement.
For example, lets say in my B4J app I have setup a connection which is a TCP connection listening on port 5432.
A new TCP connection on port 5432 is made, the server accepts that message and the client sends the ASCII message: Bob/1430/abc123
My B4J app then receives this message and splits the message into an array.
0 = Bob
1 = 1430
2 = abc123
Array 0 (Bob) is always unique, but array 1 & 2 can change.
So if I convert Array 1 to a time (14:30) I now need to write Array 2 (abc123) at 14:30 to the log but then trigger it again at 14:30 the next day.
I have come across the CallSubDelayedPlus in the CallSubUtils class. This would work and then work out the time difference etc. But can't work out how to then stop this from triggering if I then later decide I no longer want it to trigger at 14:30.
The problem I am going to have is if my server is reset, the above will stop working until it's set again. I need a way to start it again once the server is started again.
Another trigger that could happen would be:
A new TCP connection on port 5432 is made, the server accepts that message and the client sends the ASCII message: Bob/----/xyz987
When a ASCII message is sent (for Example: RUN/Bob) this would need to trigger all Bob commands which don't have a time set (----).
So if the command RUN/Bob is received it should then log xyz987 in the log only.
I was thinking of storing that trigger in a Map. However there could be over 100,000 - 200,000+ items in the map. (would I have issues having that many in a map?) However, if my server is reset I need to keep these values (just like the previous trigger), so I was thinking of creating a SQL database to store the values and then when the RUN/Bob command is received to use a SQL command to select only the Bob commands from the database and run them rather than using the map.
Anyone got any ideas on how I can do the above, or is the way I suggested (by using a SQL database) the best way ?
I am trying to work out how to do a server based triggers and macros.
I understand I can write a IF statement but I need to do this dynamically, so I can't hard code the IF statement.
For example, lets say in my B4J app I have setup a connection which is a TCP connection listening on port 5432.
A new TCP connection on port 5432 is made, the server accepts that message and the client sends the ASCII message: Bob/1430/abc123
My B4J app then receives this message and splits the message into an array.
0 = Bob
1 = 1430
2 = abc123
Array 0 (Bob) is always unique, but array 1 & 2 can change.
So if I convert Array 1 to a time (14:30) I now need to write Array 2 (abc123) at 14:30 to the log but then trigger it again at 14:30 the next day.
I have come across the CallSubDelayedPlus in the CallSubUtils class. This would work and then work out the time difference etc. But can't work out how to then stop this from triggering if I then later decide I no longer want it to trigger at 14:30.
The problem I am going to have is if my server is reset, the above will stop working until it's set again. I need a way to start it again once the server is started again.
Another trigger that could happen would be:
A new TCP connection on port 5432 is made, the server accepts that message and the client sends the ASCII message: Bob/----/xyz987
When a ASCII message is sent (for Example: RUN/Bob) this would need to trigger all Bob commands which don't have a time set (----).
So if the command RUN/Bob is received it should then log xyz987 in the log only.
I was thinking of storing that trigger in a Map. However there could be over 100,000 - 200,000+ items in the map. (would I have issues having that many in a map?) However, if my server is reset I need to keep these values (just like the previous trigger), so I was thinking of creating a SQL database to store the values and then when the RUN/Bob command is received to use a SQL command to select only the Bob commands from the database and run them rather than using the map.
Anyone got any ideas on how I can do the above, or is the way I suggested (by using a SQL database) the best way ?