Skip to content

Commit

Permalink
Merge pull request #312 from assimbly/307-enricherror-occurred-during…
Browse files Browse the repository at this point in the history
…-enrichment

ZipFileEnrichStrategy - PoolEnrich - if newExchange is null, it means there's no remote file to consume
  • Loading branch information
skin27 authored Nov 20, 2024
2 parents f825c32 + 41a6c34 commit 5e07166
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@ public class ZipFileEnrichStrategy implements AggregationStrategy {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
elementNames = new ArrayList<>();

if (newExchange == null) {
// there’s no remote file to consume
return oldExchange;
}

Message in = oldExchange.getIn();
Message resource = newExchange.getIn();

byte[] sourceZip = in.getBody(byte[].class);
byte[] resourceData = resource.getBody(byte[].class);
byte[] resourceData = newExchange.getContext().getTypeConverter().convertTo(byte[].class, resource.getBody());

String fileName = resource.getHeader(Exchange.FILE_NAME, String.class);
String fileName = resource.getHeader(Exchange.FILE_NAME_CONSUMED, String.class);

ByteArrayOutputStream baos = new ByteArrayOutputStream();

Expand Down

0 comments on commit 5e07166

Please sign in to comment.