[Question] Retrieving data from the Orbcomm gateway.

Nikolay a year ago

Hello,
again I have a question related to the Orbcomm protocol and more precisely to the class responsible for retrieving data from the Orbcomm gateway.
OrbcommProtocolPoller.java

What I want to do is to not miss information from the Orbcomm gateway.

At the moment when the server starts it applies the startTime parameter , which is the current time. The question is what happens to the data that arrived at the Orbcomm gateway , when the server was shut down?

Somewhere I should take last position with filter protocol and apply its time as startTime.

Where is the place to perform this check?

Nikolay a year ago

Hello,

I'm trying to solve my problem, but I'm having trouble constructing a database query

I have one function:

public Position getLastCustomPositionByProtocols(String[] protocols) {
         Position position = null;
        // Rewrite input
         protocols = new String[]{"ais", "orbcomm"};
         try {
             position = storage.getObject(Position.class, new Request(
                             new Columns.All(),
                             new Condition.Or(
                                     new Condition.Equals("protocol", protocols[0]),
                                     new Condition.Equals("protocol", protocols[1])
                             ),
                              // column, desc, limit
                             new Order("id", true, 1)

                     )
             );

         } catch (StorageException e) {
             LOGGER.warn("Find position error", e);
         }
         return position;
     }

The database query I'm trying to make is:

SELECT * FROM tc_positions WHERE protocol = 'ais' OR protocol = 'orbcomm' ORDER BY id DESC LIMIT 1

I see this database query in the logs:

SELECT * FROM tc_positions WHERE protocol = :protocol OR protocol = :protocol ORDER BY id DESC LIMIT 1

But the result is not the same as:

SELECT * FROM tc_positions WHERE protocol = 'ais' OR protocol = 'orbcomm' ORDER BY id DESC LIMIT 1

It absolutely always returns a result against the second parameter, which is much older.