private void poll() throws Exception
{
// get new tweets
// If I used annotations here, it won't compile under JDK 1.7
ResponseList res = this.twitter.getHomeTimeline(paging);
if (res == null || res.size() == 0)
{
return;
}
for (int i = res.size() - 1; i >= 0; i--)
{
Status status = (Status) res.get(i);
ServerMessage msg = new ServerMessageImpl(this.storageManager.generateUniqueID(),
TwitterConstants.INITIAL_MESSAGE_BUFFER_SIZE);
msg.setAddress(new SimpleString(this.queueName));
msg.setDurable(true);
msg.encodeMessageIDToBuffer();
putTweetIntoMessage(status, msg);
this.postOffice.route(msg, false);
HornetQTwitterLogger.LOGGER.debug(connectorName + ": routed: " + status.toString());
}
this.paging.setSinceId(((Status) res.get(0)).getId());
HornetQTwitterLogger.LOGGER.debug(connectorName + ": update latest ID: " + this.paging.getSinceId());
}