@Test void testResolveCorrelationData() { Map<String, Object> metaData = new HashMap<>(); metaData.put("key1", "value1"); metaData.put("key2", "value2"); metaData.put("key3", "value3"); Message message = new GenericMessage<>("payload", metaData); assertEquals(singletonMap("key1", "value1"), new SimpleCorrelationDataProvider("key1").correlationDataFor(message)); final Map<String, ?> actual2 = new SimpleCorrelationDataProvider("key1", "key2", "noExist", null) .correlationDataFor(message); assertEquals("value1", actual2.get("key1")); assertEquals("value2", actual2.get("key2")); }
@Override public Map<String, ?> correlationDataFor(Message<?> message) { if (headerNames.length == 0) { return Collections.emptyMap(); } Map<String, Object> data = new HashMap<>(); final MetaData metaData = message.getMetaData(); for (String headerName : headerNames) { if (metaData.containsKey(headerName)) { data.put(headerName, metaData.get(headerName)); } } return data; }
SimpleCorrelationDataProvider implements CorrelationDataProvider { @Override public Map<String, ?> correlationDataFor(Message<?> message) { if (headerNames.length == 0) { return Collections.emptyMap(); } Map<String, Object> data = new HashMap<>(); final MetaData metaData = message.getMetaData(); for (String headerName : headerNames) { if (metaData.containsKey(headerName)) { data.put(headerName, metaData.get(headerName)); } } return data; } }
SimpleCorrelationDataProvider implements CorrelationDataProvider { @Override public Map<String, ?> correlationDataFor(Message<?> message) { if (headerNames.length == 0) { return Collections.emptyMap(); } Map<String, Object> data = new HashMap<>(); final MetaData metaData = message.getMetaData(); for (String headerName : headerNames) { if (metaData.containsKey(headerName)) { data.put(headerName, metaData.get(headerName)); } } return data; } SimpleCorrelationDataProvider(String... metaDataKeys); }
SimpleCorrelationDataProvider implements CorrelationDataProvider { @Override public Map<String, ?> correlationDataFor(Message<?> message) { if (headerNames.length == 0) { return Collections.emptyMap(); } Map<String, Object> data = new HashMap<>(); final MetaData metaData = message.getMetaData(); for (String headerName : headerNames) { if (metaData.containsKey(headerName)) { data.put(headerName, metaData.get(headerName)); } } return data; } SimpleCorrelationDataProvider(String... metaDataKeys); @Override Map<String, ?> correlationDataFor(Message<?> message); }
SimpleCorrelationDataProvider implements CorrelationDataProvider { @Override public Map<String, ?> correlationDataFor(Message<?> message) { if (headerNames.length == 0) { return Collections.emptyMap(); } Map<String, Object> data = new HashMap<>(); final MetaData metaData = message.getMetaData(); for (String headerName : headerNames) { if (metaData.containsKey(headerName)) { data.put(headerName, metaData.get(headerName)); } } return data; } SimpleCorrelationDataProvider(String... metaDataKeys); @Override Map<String, ?> correlationDataFor(Message<?> message);  }