@Test void testMessagesWithoutTags() { SimpleMeterRegistry meterRegistry = new SimpleMeterRegistry(); MessageCountingMonitor testSubject = MessageCountingMonitor.buildMonitor(PROCESSOR_NAME, meterRegistry); EventMessage<Object> foo = asEventMessage(1); EventMessage<Object> bar = asEventMessage("bar"); EventMessage<Object> baz = asEventMessage("baz"); Map<? super Message<?>, MessageMonitor.MonitorCallback> callbacks = testSubject .onMessagesIngested(Arrays.asList(foo, bar, baz)); callbacks.get(foo).reportSuccess(); callbacks.get(bar).reportFailure(null); callbacks.get(baz).reportIgnored(); Counter ingestedCounter = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".ingestedCounter").counter()); Counter processedCounter = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".processedCounter").counter()); Counter successCounter = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".successCounter").counter()); Counter failureCounter = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".failureCounter").counter()); Counter ignoredCounter = requireNonNull(meterRegistry.find(PROCESSOR_NAME + ".ignoredCounter").counter()); assertEquals(3, ingestedCounter.count(), 0); assertEquals(2, processedCounter.count(), 0); assertEquals(1, successCounter.count(), 0); assertEquals(1, failureCounter.count(), 0); assertEquals(1, ignoredCounter.count(), 0); }
public static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new MessageCountingMonitor(meterNamePrefix, meterRegistry); }
MessageCountingMonitor implements MessageMonitor<Message<?>> { public static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new MessageCountingMonitor(meterNamePrefix, meterRegistry); } }
MessageCountingMonitor implements MessageMonitor<Message<?>> { public static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new MessageCountingMonitor(meterNamePrefix, meterRegistry); } private  MessageCountingMonitor(String meterNamePrefix, MeterRegistry meterRegistry); private  MessageCountingMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                   Function<Message<?>, Iterable<Tag>> tagsBuilder); }
MessageCountingMonitor implements MessageMonitor<Message<?>> { public static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new MessageCountingMonitor(meterNamePrefix, meterRegistry); } private  MessageCountingMonitor(String meterNamePrefix, MeterRegistry meterRegistry); private  MessageCountingMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                   Function<Message<?>, Iterable<Tag>> tagsBuilder); static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry); static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                                      Function<Message<?>, Iterable<Tag>> tagsBuilder); @Override MonitorCallback onMessageIngested(Message<?> message); }
MessageCountingMonitor implements MessageMonitor<Message<?>> { public static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry) { return new MessageCountingMonitor(meterNamePrefix, meterRegistry); } private  MessageCountingMonitor(String meterNamePrefix, MeterRegistry meterRegistry); private  MessageCountingMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                   Function<Message<?>, Iterable<Tag>> tagsBuilder); static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry); static MessageCountingMonitor buildMonitor(String meterNamePrefix, MeterRegistry meterRegistry,
                                                      Function<Message<?>, Iterable<Tag>> tagsBuilder); @Override MonitorCallback onMessageIngested(Message<?> message);  }