public Broadcaster createBroadcaster(String ID) { Broadcaster b = BroadcasterFactory.getDefault().get(DefaultBroadcaster.class, ID); atm.setBroadcaster(b); return b; } }
@EventHandler public void handle(TradeExecutedEvent event) { LOGGER.debug("all broadcasters: \n" + BroadcasterFactory.getDefault().lookupAll()); LOGGER.debug("handling TradeExecutedEvent: {}", event); BroadcastHelper.broadcastTrade(event); } }
private static Broadcaster lookupDefaultBroadcaster() { BroadcasterFactory factory = BroadcasterFactory.getDefault(); if (factory == null) { throw new WicketRuntimeException( "There is no Atmosphere BroadcasterFactory configured. Did you include the " + "atmosphere.xml configuration file and configured AtmosphereServlet?"); } Collection<Broadcaster> allBroadcasters = factory.lookupAll(); if (allBroadcasters.isEmpty()) { throw new WicketRuntimeException( "The Atmosphere BroadcasterFactory has no Broadcasters, " + "something is wrong with your Atmosphere configuration."); } return allBroadcasters.iterator().next(); }
private static Broadcaster lookupDefaultBroadcaster() { BroadcasterFactory factory = BroadcasterFactory.getDefault(); if (factory == null) { throw new WicketRuntimeException( "There is no Atmosphere BroadcasterFactory configured. Did you include the " + "atmosphere.xml configuration file and configured AtmosphereServlet?"); } Collection<Broadcaster> allBroadcasters = factory.lookupAll(); if (allBroadcasters.isEmpty()) { throw new WicketRuntimeException( "The Atmosphere BroadcasterFactory has no Broadcasters, " + "something is wrong with your Atmosphere configuration."); } return allBroadcasters.iterator().next(); }
/** * This is the main entrypoint on the server that you will want to hook into and override. * This method is called when a client has request a new connection. Best practice is to do all your * required setup here and tie the AtmosphereResource to a Broadcaster, but do not send anything to * the client yet. If you wish to do so it is best to let the client send a notification to the server * using the {@link AtmosphereClient#post} method in the onConnected event. * * @param resource * @return * @throws ServletException * @throws IOException */ public int doComet(GwtAtmosphereResource resource) throws ServletException, IOException { Broadcaster broadcaster = BroadcasterFactory.getDefault().lookup(Broadcaster.class, GWT_BROADCASTER_ID); if (broadcaster == null) { broadcaster = BroadcasterFactory.getDefault().get(DefaultBroadcaster.class, GWT_BROADCASTER_ID); } resource.getAtmosphereResource().setBroadcaster(broadcaster); return NO_TIMEOUT; }
/** * This is the main entrypoint on the server that you will want to hook into and override. * This method is called when a client has request a new connection. Best practice is to do all your * required setup here and tie the AtmosphereResource to a Broadcaster, but do not send anything to * the client yet. If you wish to do so it is best to let the client send a notification to the server * using the {@link AtmosphereClient#post} method in the onConnected event. * * @param resource * @return * @throws ServletException * @throws IOException */ public int doComet(GwtAtmosphereResource resource) throws ServletException, IOException { Broadcaster broadcaster = BroadcasterFactory.getDefault().lookup(Broadcaster.class, GWT_BROADCASTER_ID); if (broadcaster == null) { broadcaster = BroadcasterFactory.getDefault().get(DefaultBroadcaster.class, GWT_BROADCASTER_ID); } resource.getAtmosphereResource().setBroadcaster(broadcaster); return NO_TIMEOUT; }