use of org.jumpmind.symmetric.model.ChannelMap in project symmetric-ds by JumpMind.
the class HttpOutgoingTransport method getSuspendIgnoreChannelLists.
public ChannelMap getSuspendIgnoreChannelLists(IConfigurationService configurationService, String queue, Node targetNode) {
HttpURLConnection connection = requestReservation(queue);
// Connection contains remote suspend/ignore channels list if
// reservation was successful.
ChannelMap suspendIgnoreChannelsList = new ChannelMap();
String suspends = connection.getHeaderField(WebConstants.SUSPENDED_CHANNELS);
String ignores = connection.getHeaderField(WebConstants.IGNORED_CHANNELS);
suspendIgnoreChannelsList.addSuspendChannels(suspends);
suspendIgnoreChannelsList.addIgnoreChannels(ignores);
ChannelMap localSuspendIgnoreChannelsList = configurationService.getSuspendIgnoreChannelLists(targetNode.getNodeId());
suspendIgnoreChannelsList.addSuspendChannels(localSuspendIgnoreChannelsList.getSuspendChannels());
suspendIgnoreChannelsList.addIgnoreChannels(localSuspendIgnoreChannelsList.getIgnoreChannels());
return suspendIgnoreChannelsList;
}
use of org.jumpmind.symmetric.model.ChannelMap in project symmetric-ds by JumpMind.
the class DataExtractorService method extract.
public List<OutgoingBatch> extract(ProcessInfo processInfo, Node targetNode, String queue, IOutgoingTransport transport) {
/*
* make sure that data is routed before extracting if the route job is
* not configured to start automatically
*/
if (!parameterService.is(ParameterConstants.START_ROUTE_JOB) && parameterService.is(ParameterConstants.ROUTE_ON_EXTRACT)) {
routerService.routeData(true);
}
OutgoingBatches batches = null;
if (queue != null) {
NodeGroupLinkAction defaultAction = configurationService.getNodeGroupLinkFor(nodeService.findIdentity().getNodeGroupId(), targetNode.getNodeGroupId(), false).getDataEventAction();
ProcessInfoKey.ProcessType processType = processInfo.getKey().getProcessType();
NodeGroupLinkAction action = null;
if (processType.equals(ProcessInfoKey.ProcessType.PUSH_JOB)) {
action = NodeGroupLinkAction.P;
} else if (processType.equals(ProcessInfoKey.ProcessType.PULL_HANDLER)) {
action = NodeGroupLinkAction.W;
}
batches = outgoingBatchService.getOutgoingBatches(targetNode.getNodeId(), queue, action, defaultAction, false);
} else {
batches = outgoingBatchService.getOutgoingBatches(targetNode.getNodeId(), false);
}
if (batches.containsBatches()) {
ChannelMap channelMap = transport.getSuspendIgnoreChannelLists(configurationService, queue, targetNode);
List<OutgoingBatch> activeBatches = filterBatchesForExtraction(batches, channelMap);
if (activeBatches.size() > 0) {
BufferedWriter writer = transport.openWriter();
IDataWriter dataWriter = new ProtocolDataWriter(nodeService.findIdentityNodeId(), writer, targetNode.requires13Compatiblity());
return extract(processInfo, targetNode, activeBatches, dataWriter, writer, ExtractMode.FOR_SYM_CLIENT);
}
}
return Collections.emptyList();
}
use of org.jumpmind.symmetric.model.ChannelMap in project symmetric-ds by JumpMind.
the class MakeReservationUriHandler method buildSuspendIgnoreResponseHeaders.
protected void buildSuspendIgnoreResponseHeaders(final String nodeId, final ServletResponse resp) {
HttpServletResponse httpResponse = (HttpServletResponse) resp;
ChannelMap suspendIgnoreChannels = engine.getConfigurationService().getSuspendIgnoreChannelLists(nodeId);
httpResponse.setHeader(WebConstants.SUSPENDED_CHANNELS, suspendIgnoreChannels.getSuspendChannelsAsString());
httpResponse.setHeader(WebConstants.IGNORED_CHANNELS, suspendIgnoreChannels.getIgnoreChannelsAsString());
}
use of org.jumpmind.symmetric.model.ChannelMap in project symmetric-ds by JumpMind.
the class PullUriHandler method handleWithCompression.
public void handleWithCompression(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
// request has the "other" nodes info
String nodeId = ServletUtils.getParameter(req, WebConstants.NODE_ID);
log.debug("Pull request received from {}", nodeId);
if (StringUtils.isBlank(nodeId)) {
ServletUtils.sendError(res, HttpServletResponse.SC_BAD_REQUEST, "Node must be specified");
return;
}
ChannelMap map = new ChannelMap();
map.addSuspendChannels(req.getHeader(WebConstants.SUSPENDED_CHANNELS));
map.addIgnoreChannels(req.getHeader(WebConstants.IGNORED_CHANNELS));
// pull out headers and pass to pull() method
pull(nodeId, req.getRemoteHost(), req.getRemoteAddr(), res.getOutputStream(), req.getHeader(WebConstants.HEADER_ACCEPT_CHARSET), map);
log.debug("Done with Pull request from {}", nodeId);
}
use of org.jumpmind.symmetric.model.ChannelMap in project symmetric-ds by JumpMind.
the class DataExtractorService method extract.
public List<OutgoingBatch> extract(ProcessInfo processInfo, Node targetNode, IOutgoingTransport transport) {
/*
* make sure that data is routed before extracting if the route job is
* not configured to start automatically
*/
if (!parameterService.is(ParameterConstants.START_ROUTE_JOB)) {
routerService.routeData(true);
}
OutgoingBatches batches = outgoingBatchService.getOutgoingBatches(targetNode.getNodeId(), false);
if (batches.containsBatches()) {
ChannelMap channelMap = transport.getSuspendIgnoreChannelLists(configurationService, targetNode);
List<OutgoingBatch> activeBatches = filterBatchesForExtraction(batches, channelMap);
if (activeBatches.size() > 0) {
IDataWriter dataWriter = new ProtocolDataWriter(nodeService.findIdentityNodeId(), transport.openWriter(), targetNode.requires13Compatiblity());
return extract(processInfo, targetNode, activeBatches, dataWriter, ExtractMode.FOR_SYM_CLIENT);
}
}
return Collections.emptyList();
}
Aggregations