@Test public void testWithFilter() throws Exception { aggregator.setReplaceOriginalMessage(false); aggregator.setFilterCondition(new EvenOddCondition()); aggregator.aggregate(message, messages); assertFalse(aggregator.getReplaceOriginalMessage()); assertEquals(2, message.getPayloadCount()); }
@Override public void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> msgs) throws CoreException { if (!(original instanceof MultiPayloadAdaptrisMessage)) { throw new CoreException("Original not a multi-payload message, cannot merge"); } log.trace("Adding messages to existing message [{}]", original.getUniqueId()); MultiPayloadAdaptrisMessage multiMessage = (MultiPayloadAdaptrisMessage) original; String originalId = multiMessage.getCurrentPayloadId(); long count = 0; for (AdaptrisMessage message : msgs) { if (filter(message)) { count++; log.trace("Adding message payload [{}]", message.getUniqueId()); multiMessage.addPayload(message.getUniqueId(), message.getPayload()); } } if (replaceOriginal()) { multiMessage.deletePayload(originalId); } log.trace("Finished adding {} messages", count); }
MultiPayloadMessageAggregator extends MessageAggregatorImpl { @Override public void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> msgs) throws CoreException { if (!(original instanceof MultiPayloadAdaptrisMessage)) { throw new CoreException("Original not a multi-payload message, cannot merge"); } log.trace("Adding messages to existing message [{}]", original.getUniqueId()); MultiPayloadAdaptrisMessage multiMessage = (MultiPayloadAdaptrisMessage) original; String originalId = multiMessage.getCurrentPayloadId(); long count = 0; for (AdaptrisMessage message : msgs) { if (filter(message)) { count++; log.trace("Adding message payload [{}]", message.getUniqueId()); multiMessage.addPayload(message.getUniqueId(), message.getPayload()); } } if (replaceOriginal()) { multiMessage.deletePayload(originalId); } log.trace("Finished adding {} messages", count); } }
MultiPayloadMessageAggregator extends MessageAggregatorImpl { @Override public void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> msgs) throws CoreException { if (!(original instanceof MultiPayloadAdaptrisMessage)) { throw new CoreException("Original not a multi-payload message, cannot merge"); } log.trace("Adding messages to existing message [{}]", original.getUniqueId()); MultiPayloadAdaptrisMessage multiMessage = (MultiPayloadAdaptrisMessage) original; String originalId = multiMessage.getCurrentPayloadId(); long count = 0; for (AdaptrisMessage message : msgs) { if (filter(message)) { count++; log.trace("Adding message payload [{}]", message.getUniqueId()); multiMessage.addPayload(message.getUniqueId(), message.getPayload()); } } if (replaceOriginal()) { multiMessage.deletePayload(originalId); } log.trace("Finished adding {} messages", count); }  }
MultiPayloadMessageAggregator extends MessageAggregatorImpl { @Override public void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> msgs) throws CoreException { if (!(original instanceof MultiPayloadAdaptrisMessage)) { throw new CoreException("Original not a multi-payload message, cannot merge"); } log.trace("Adding messages to existing message [{}]", original.getUniqueId()); MultiPayloadAdaptrisMessage multiMessage = (MultiPayloadAdaptrisMessage) original; String originalId = multiMessage.getCurrentPayloadId(); long count = 0; for (AdaptrisMessage message : msgs) { if (filter(message)) { count++; log.trace("Adding message payload [{}]", message.getUniqueId()); multiMessage.addPayload(message.getUniqueId(), message.getPayload()); } } if (replaceOriginal()) { multiMessage.deletePayload(originalId); } log.trace("Finished adding {} messages", count); }  @Override void joinMessage(AdaptrisMessage original, Collection<AdaptrisMessage> messages); @Override void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> msgs); }
MultiPayloadMessageAggregator extends MessageAggregatorImpl { @Override public void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> msgs) throws CoreException { if (!(original instanceof MultiPayloadAdaptrisMessage)) { throw new CoreException("Original not a multi-payload message, cannot merge"); } log.trace("Adding messages to existing message [{}]", original.getUniqueId()); MultiPayloadAdaptrisMessage multiMessage = (MultiPayloadAdaptrisMessage) original; String originalId = multiMessage.getCurrentPayloadId(); long count = 0; for (AdaptrisMessage message : msgs) { if (filter(message)) { count++; log.trace("Adding message payload [{}]", message.getUniqueId()); multiMessage.addPayload(message.getUniqueId(), message.getPayload()); } } if (replaceOriginal()) { multiMessage.deletePayload(originalId); } log.trace("Finished adding {} messages", count); }  @Override void joinMessage(AdaptrisMessage original, Collection<AdaptrisMessage> messages); @Override void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> msgs);  }