@Test public void shouldProxyBroadcastEventsInOSGi() { Map<String, Object> params = new HashMap<>(); params.put("proxy-in-osgi", true); MotechEvent event = new MotechEvent("subject", params); eventRelay.relayTopicEvent(event); ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class); verify(eventAdmin).postEvent(captor.capture()); assertEquals("subject", captor.getValue().getTopic()); }
public void relayTopicEvent(MotechEvent event) { verifyEventNotNull(event); Set<EventListener> listeners = getEventListeners(event); for (EventListener listener : listeners) { handleTopicEvent(listener, event); } if (proxyInOsgi(event)) { sendInOSGi(event); } }
ServerEventRelay implements EventRelay, EventHandler { public void relayTopicEvent(MotechEvent event) { verifyEventNotNull(event); Set<EventListener> listeners = getEventListeners(event); for (EventListener listener : listeners) { handleTopicEvent(listener, event); } if (proxyInOsgi(event)) { sendInOSGi(event); } } }
ServerEventRelay implements EventRelay, EventHandler { public void relayTopicEvent(MotechEvent event) { verifyEventNotNull(event); Set<EventListener> listeners = getEventListeners(event); for (EventListener listener : listeners) { handleTopicEvent(listener, event); } if (proxyInOsgi(event)) { sendInOSGi(event); } } @Autowired  ServerEventRelay(OutboundEventGateway outboundEventGateway, EventListenerRegistry eventListenerRegistry, MotechEventConfig motechEventConfig,
                            EventAdmin osgiEventAdmin, BundleContext bundleContext); }
ServerEventRelay implements EventRelay, EventHandler { public void relayTopicEvent(MotechEvent event) { verifyEventNotNull(event); Set<EventListener> listeners = getEventListeners(event); for (EventListener listener : listeners) { handleTopicEvent(listener, event); } if (proxyInOsgi(event)) { sendInOSGi(event); } } @Autowired  ServerEventRelay(OutboundEventGateway outboundEventGateway, EventListenerRegistry eventListenerRegistry, MotechEventConfig motechEventConfig,
                            EventAdmin osgiEventAdmin, BundleContext bundleContext); @Override void sendEventMessage(MotechEvent event); @Override void broadcastEventMessage(MotechEvent event); void relayQueueEvent(MotechEvent event); void relayTopicEvent(MotechEvent event); @Override void handleEvent(Event osgiEvent); }
ServerEventRelay implements EventRelay, EventHandler { public void relayTopicEvent(MotechEvent event) { verifyEventNotNull(event); Set<EventListener> listeners = getEventListeners(event); for (EventListener listener : listeners) { handleTopicEvent(listener, event); } if (proxyInOsgi(event)) { sendInOSGi(event); } } @Autowired  ServerEventRelay(OutboundEventGateway outboundEventGateway, EventListenerRegistry eventListenerRegistry, MotechEventConfig motechEventConfig,
                            EventAdmin osgiEventAdmin, BundleContext bundleContext); @Override void sendEventMessage(MotechEvent event); @Override void broadcastEventMessage(MotechEvent event); void relayQueueEvent(MotechEvent event); void relayTopicEvent(MotechEvent event); @Override void handleEvent(Event osgiEvent);  }