private void handleJobStartMessage(Message message) throws Exception { FeedJobInfo jobInfo = jobInfos.get(message.jobId); switch (jobInfo.getJobType()) { case INTAKE: handleIntakeJobStartMessage((FeedIntakeInfo) jobInfo); break; case FEED_CONNECT: handleCollectJobStartMessage((FeedConnectJobInfo) jobInfo); break; } }
private void handleJobFinishMessage(Message message) throws Exception { FeedJobInfo jobInfo = jobInfos.get(message.jobId); switch (jobInfo.getJobType()) { case INTAKE: if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Intake Job finished for feed intake " + jobInfo.getJobId()); } handleFeedIntakeJobFinishMessage((FeedIntakeInfo) jobInfo, message); break; case FEED_CONNECT: if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Collect Job finished for " + (FeedConnectJobInfo) jobInfo); } handleFeedCollectJobFinishMessage((FeedConnectJobInfo) jobInfo); break; } }
private void notifyFeedEventSubscribers(FeedJobInfo jobInfo, FeedLifecycleEvent event) { JobType jobType = jobInfo.getJobType(); List<FeedConnectionId> impactedConnections = new ArrayList<FeedConnectionId>(); if (jobType.equals(JobType.INTAKE)) { FeedId feedId = ((FeedIntakeInfo) jobInfo).getFeedId(); for (FeedConnectionId connId : eventSubscribers.keySet()) { if (connId.getFeedId().equals(feedId)) { impactedConnections.add(connId); } } } else { impactedConnections.add(((FeedConnectJobInfo) jobInfo).getConnectionId()); } for (FeedConnectionId connId : impactedConnections) { List<IFeedLifecycleEventSubscriber> subscribers = eventSubscribers.get(connId); if (subscribers != null && !subscribers.isEmpty()) { for (IFeedLifecycleEventSubscriber subscriber : subscribers) { subscriber.handleFeedEvent(event); } } } }