Search in sources :

Example 1 with Inbox

use of org.apache.ignite.internal.sql.engine.exec.rel.Inbox in project ignite-3 by apache.

the class ExchangeServiceImpl method onMessage.

protected void onMessage(String nodeId, QueryBatchMessage msg) {
    Inbox<?> inbox = mailboxRegistry.inbox(msg.queryId(), msg.exchangeId());
    if (inbox == null && msg.batchId() == 0) {
        // first message sent before a fragment is built
        // note that an inbox source fragment id is also used as an exchange id
        Inbox<?> newInbox = new Inbox<>(baseInboxContext(nodeId, msg.queryId(), msg.fragmentId()), this, mailboxRegistry, msg.exchangeId(), msg.exchangeId());
        inbox = mailboxRegistry.register(newInbox);
    }
    if (inbox != null) {
        try {
            inbox.onBatchReceived(nodeId, msg.batchId(), msg.last(), Commons.cast(msg.rows()));
        } catch (Throwable e) {
            inbox.onError(e);
            throw new IgniteInternalException("Unexpected exception", e);
        }
    } else if (LOG.isDebugEnabled()) {
        LOG.debug("Stale batch message received: [" + "nodeId=" + nodeId + ", " + "queryId=" + msg.queryId() + ", " + "fragmentId=" + msg.fragmentId() + ", " + "exchangeId=" + msg.exchangeId() + ", " + "batchId=" + msg.batchId() + "]");
    }
}
Also used : IgniteInternalException(org.apache.ignite.lang.IgniteInternalException) Inbox(org.apache.ignite.internal.sql.engine.exec.rel.Inbox)

Aggregations

Inbox (org.apache.ignite.internal.sql.engine.exec.rel.Inbox)1 IgniteInternalException (org.apache.ignite.lang.IgniteInternalException)1