@Override public void close() throws Exception { super.close(); sessionIds.clear(); sessionIdsPerSnapshot.clear(); }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); sessionIds = new ArrayList<>(64); sessionIdsPerSnapshot = new ArrayDeque<>(); }
@Override public void notifyCheckpointComplete(long checkpointId) throws Exception { LOG.debug("Committing Messages externally for checkpoint {}", checkpointId); for (Iterator<Tuple2<Long, Set<UId>>> iter = pendingCheckpoints.iterator(); iter.hasNext();) { Tuple2<Long, Set<UId>> checkpoint = iter.next(); long id = checkpoint.f0; if (id <= checkpointId) { LOG.trace("Committing Messages with following IDs {}", checkpoint.f1); acknowledgeIDs(checkpointId, checkpoint.f1); // remove deduplication data idsProcessedButNotAcknowledged.removeAll(checkpoint.f1); // remove checkpoint data iter.remove(); } else { break; } } } }
@Override public void snapshotState(FunctionSnapshotContext context) throws Exception { sessionIdsPerSnapshot.add(new Tuple2<>(context.getCheckpointId(), sessionIds)); sessionIds = new ArrayList<>(64); super.snapshotState(context); } }
@Override public void snapshotState(FunctionSnapshotContext context) throws Exception { sessionIdsPerSnapshot.add(new Tuple2<>(context.getCheckpointId(), sessionIds)); sessionIds = new ArrayList<>(64); super.snapshotState(context); } }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); sessionIds = new ArrayList<>(64); sessionIdsPerSnapshot = new ArrayDeque<>(); }
@Override public void close() throws Exception { super.close(); sessionIds.clear(); sessionIdsPerSnapshot.clear(); }
@Override public void snapshotState(FunctionSnapshotContext context) throws Exception { sessionIdsPerSnapshot.add(new Tuple2<>(context.getCheckpointId(), sessionIds)); sessionIds = new ArrayList<>(64); super.snapshotState(context); } }
@Override public void notifyCheckpointComplete(long checkpointId) throws Exception { LOG.debug("Committing Messages externally for checkpoint {}", checkpointId); for (Iterator<Tuple2<Long, Set<UId>>> iter = pendingCheckpoints.iterator(); iter.hasNext();) { Tuple2<Long, Set<UId>> checkpoint = iter.next(); long id = checkpoint.f0; if (id <= checkpointId) { LOG.trace("Committing Messages with following IDs {}", checkpoint.f1); acknowledgeIDs(checkpointId, checkpoint.f1); // remove deduplication data idsProcessedButNotAcknowledged.removeAll(checkpoint.f1); // remove checkpoint data iter.remove(); } else { break; } } } }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); sessionIds = new ArrayList<>(64); sessionIdsPerSnapshot = new ArrayDeque<>(); }
@Override public void close() throws Exception { super.close(); sessionIds.clear(); sessionIdsPerSnapshot.clear(); }
@Override public void snapshotState(FunctionSnapshotContext context) throws Exception { sessionIdsPerSnapshot.add(new Tuple2<>(context.getCheckpointId(), sessionIds)); sessionIds = new ArrayList<>(64); super.snapshotState(context); } }
@Override public void notifyCheckpointComplete(long checkpointId) throws Exception { LOG.debug("Committing Messages externally for checkpoint {}", checkpointId); for (Iterator<Tuple2<Long, Set<UId>>> iter = pendingCheckpoints.iterator(); iter.hasNext();) { Tuple2<Long, Set<UId>> checkpoint = iter.next(); long id = checkpoint.f0; if (id <= checkpointId) { LOG.trace("Committing Messages with following IDs {}", checkpoint.f1); acknowledgeIDs(checkpointId, checkpoint.f1); // remove deduplication data idsProcessedButNotAcknowledged.removeAll(checkpoint.f1); // remove checkpoint data iter.remove(); } else { break; } } } }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); sessionIds = new ArrayList<>(64); sessionIdsPerSnapshot = new ArrayDeque<>(); }
@Override public void close() throws Exception { super.close(); sessionIds.clear(); sessionIdsPerSnapshot.clear(); }
@Override public void notifyCheckpointComplete(long checkpointId) throws Exception { LOG.debug("Committing Messages externally for checkpoint {}", checkpointId); for (Iterator<Tuple2<Long, List<UId>>> iter = pendingCheckpoints.iterator(); iter.hasNext();) { Tuple2<Long, List<UId>> checkpoint = iter.next(); long id = checkpoint.f0; if (id <= checkpointId) { LOG.trace("Committing Messages with following IDs {}", checkpoint.f1); acknowledgeIDs(checkpointId, checkpoint.f1); // remove deduplication data idsProcessedButNotAcknowledged.removeAll(checkpoint.f1); // remove checkpoint data iter.remove(); } else { break; } } } }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); final RuntimeContext context = getRuntimeContext(); if (context instanceof StreamingRuntimeContext) { isCheckpointingEnabled = ((StreamingRuntimeContext) context).isCheckpointingEnabled(); } client = createClient(); consumer = createConsumer(client); isRunning = true; }
@Override public void close() throws Exception { super.close(); IOUtils.cleanup(LOG, consumer); IOUtils.cleanup(LOG, client); }
@Override public void open(Configuration config) throws Exception { super.open(config); // Create a Connection connection = connectionFactory.createConnection(); connection.start(); exceptionListener = new AMQExceptionListener(LOG, logFailuresOnly); connection.setExceptionListener(exceptionListener); RuntimeContext runtimeContext = getRuntimeContext(); int acknowledgeType; if (runtimeContext instanceof StreamingRuntimeContext && ((StreamingRuntimeContext) runtimeContext).isCheckpointingEnabled()) { autoAck = false; acknowledgeType = ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE; } else { autoAck = true; acknowledgeType = ActiveMQSession.AUTO_ACKNOWLEDGE; } // Create a Session session = connection.createSession(false, acknowledgeType); // Create the destination (Topic or Queue) Destination destination = AMQUtil.getDestination(session, destinationType, destinationName); // Create a MessageConsumer from the Session to the Topic or // Queue consumer = session.createConsumer(destination); runningChecker.setIsRunning(true); }
@Override public void close() throws Exception { super.close(); RuntimeException exception = null; try {