Tabnine Logo
SseBroadcaster.add
Code IndexAdd Tabnine to your IDE (free)

How to use
add
method
in
org.glassfish.jersey.media.sse.SseBroadcaster

Best Java code snippets using org.glassfish.jersey.media.sse.SseBroadcaster.add (Showing top 11 results out of 315)

origin: jersey/jersey

/**
 * Get the new SSE message stream channel.
 *
 * @return new SSE message stream channel.
 */
@GET
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput getMessageStream() {
  LOGGER.info("--> SSE connection received.");
  final EventOutput eventOutput = new EventOutput();
  broadcaster.add(eventOutput);
  return eventOutput;
}
origin: jersey/jersey

@Path("process/{id}")
@Produces(SseFeature.SERVER_SENT_EVENTS)
@GET
public EventOutput getProgress(@PathParam("id") int id,
                @DefaultValue("false") @QueryParam("testSource") boolean testSource) {
  final Process process = processes.get(id);
  if (process != null) {
    if (testSource) {
      process.release();
    }
    final EventOutput eventOutput = new EventOutput();
    process.getBroadcaster().add(eventOutput);
    return eventOutput;
  } else {
    throw new NotFoundException();
  }
}
origin: org.terracotta/management-common-resources-v2

@Override
public <OUT extends ChunkedOutput<OutboundEvent>> boolean add(OUT chunkedOutput) {
 outputs.put((TerracottaEventOutput) chunkedOutput, new TerracottaEventOutputFlushingMetadata());
 return super.add(chunkedOutput);
}
origin: org.eclipse.smarthome.io/org.eclipse.smarthome.io.rest.sitemap

protected void activate() {
  broadcaster = new SseBroadcaster();
  broadcaster.add(this);
}
origin: vgoldin/cqrs-eventsourcing-kafka

@GET
@Path("/events.stream")
@Produces(SseFeature.SERVER_SENT_EVENTS)
@ApiOperation(value = "Get Event Stream of Application Events", notes = "Returns a continuous stream of application events using Server-Sent Events.")
public EventOutput errors() {
  final EventOutput eventOutput = new EventOutput();
  BROADCASTER.add(eventOutput);
  return eventOutput;
}
origin: org.eclipse.smarthome.io/org.eclipse.smarthome.io.rest.sitemap

/**
 * Creates a subscription for the stream of sitemap events.
 *
 * @return a subscription id
 */
@POST
@Path(SEGMENT_EVENTS + "/subscribe")
@ApiOperation(value = "Creates a sitemap event subscription.")
@ApiResponses(value = { @ApiResponse(code = 201, message = "Subscription created.") })
public Object createEventSubscription() {
  String subscriptionId = subscriptions.createSubscription(this);
  final EventOutput eventOutput = new SitemapEventOutput(subscriptions, subscriptionId);
  broadcaster.add(eventOutput);
  eventOutputs.put(subscriptionId, eventOutput);
  URI uri = uriInfo.getBaseUriBuilder().path(PATH_SITEMAPS).path(SEGMENT_EVENTS).path(subscriptionId).build();
  return Response.created(uri);
}
origin: openhab/openhab-core

@Activate
protected void activate() {
  broadcaster = new SseBroadcaster();
  broadcaster.add(this);
  // The clean SSE subscriptions job sends an ALIVE event to all subscribers. This will trigger
  // an exception when the subscriber is dead, leading to the release of the SSE subscription
  // on server side.
  // In practice, the exception occurs only after the sending of a second ALIVE event. So this
  // will require two runs of the job to release an SSE subscription.
  // The clean SSE subscriptions job is run every 5 minutes.
  cleanSubscriptionsJob = scheduler.scheduleAtFixedRate(() -> {
    logger.debug("Run clean SSE subscriptions job");
    if (subscriptions != null) {
      subscriptions.checkAliveClients();
    }
  }, 1, 5, TimeUnit.MINUTES);
}
origin: openhab/openhab-core

/**
 * Creates a subscription for the stream of sitemap events.
 *
 * @return a subscription id
 */
@POST
@Path(SEGMENT_EVENTS + "/subscribe")
@ApiOperation(value = "Creates a sitemap event subscription.")
@ApiResponses(value = { @ApiResponse(code = 201, message = "Subscription created."),
    @ApiResponse(code = 503, message = "Subscriptions limit reached.") })
public Object createEventSubscription() {
  String subscriptionId = subscriptions.createSubscription(this);
  if (subscriptionId == null) {
    return JSONResponse.createResponse(Status.SERVICE_UNAVAILABLE, null,
        "Max number of subscriptions is reached.");
  }
  final EventOutput eventOutput = new SitemapEventOutput(subscriptions, subscriptionId);
  broadcaster.add(eventOutput);
  eventOutputs.put(subscriptionId, eventOutput);
  URI uri = uriInfo.getBaseUriBuilder().path(PATH_SITEMAPS).path(SEGMENT_EVENTS).path(subscriptionId).build();
  logger.debug("Client from IP {} requested new subscription => got id {}.", request.getRemoteAddr(),
      subscriptionId);
  return Response.created(uri);
}
origin: openhab/openhab-core

broadcaster.add(eventOutput);
origin: org.eclipse.smarthome.io/org.eclipse.smarthome.io.rest.sse

broadcaster.add(eventOutput);
origin: stackoverflow.com

broadcaster.add(eventOutput);
return eventOutput;
org.glassfish.jersey.media.sseSseBroadcasteradd

Popular methods of SseBroadcaster

  • broadcast
  • <init>
    Can be used by subclasses to override the default functionality of adding self to the set of org.gla
  • remove
  • addListener
  • closeAll

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • BoxLayout (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now