kandi background
Explore Kits

sse-eventbus | EventBus library for sending events | Pub Sub library

 by   ralscha Java Version: Current License: Apache-2.0

 by   ralscha Java Version: Current License: Apache-2.0

Download this library from

kandi X-RAY | sse-eventbus Summary

sse-eventbus is a Java library typically used in Messaging, Pub Sub, Spring applications. sse-eventbus has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. However sse-eventbus has 9 bugs. You can download it from GitHub, Maven.
sse-eventbus is a Java library that sits on top of Spring's Sever-Sent Event support. It keeps track of connected clients and broadcasts events to them.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • sse-eventbus has a low active ecosystem.
  • It has 61 star(s) with 19 fork(s). There are 8 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 0 open issues and 17 have been closed. On average issues are closed in 42 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of sse-eventbus is current.
sse-eventbus Support
Best in #Pub Sub
Average in #Pub Sub
sse-eventbus Support
Best in #Pub Sub
Average in #Pub Sub

quality kandi Quality

  • sse-eventbus has 9 bugs (1 blocker, 0 critical, 8 major, 0 minor) and 45 code smells.
sse-eventbus Quality
Best in #Pub Sub
Average in #Pub Sub
sse-eventbus Quality
Best in #Pub Sub
Average in #Pub Sub

securitySecurity

  • sse-eventbus has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • sse-eventbus code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
sse-eventbus Security
Best in #Pub Sub
Average in #Pub Sub
sse-eventbus Security
Best in #Pub Sub
Average in #Pub Sub

license License

  • sse-eventbus is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
sse-eventbus License
Best in #Pub Sub
Average in #Pub Sub
sse-eventbus License
Best in #Pub Sub
Average in #Pub Sub

buildReuse

  • sse-eventbus releases are not available. You will need to build from source code and install.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • It has 2003 lines of code, 194 functions and 25 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
sse-eventbus Reuse
Best in #Pub Sub
Average in #Pub Sub
sse-eventbus Reuse
Best in #Pub Sub
Average in #Pub Sub
Top functions reviewed by kandi - BETA

kandi has reviewed sse-eventbus and discovered the below as its top functions. This is intended to give you an instant insight into sse-eventbus implemented functionality, and help decide if they suit your requirements.

  • Internal event loop
  • Starts the downloader .
  • Re - schedule failed events .
  • The event bus .
  • Creates SSE event builder .
  • Downloads a file from an URL
  • Returns true if the client is subscribed to the given event name and event .
  • Converts SSEEvent to string .
  • Unsubscribes event subscribers .
  • Returns true if the server supports SSEEvent .

sse-eventbus Key Features

EventBus library for sending events from a Spring appliction to the web browser with SSE

Setup server

copy iconCopydownload iconDownload
@SpringBootApplication
@EnableSseEventBus
public class Application {
  ...
}

Setup client

copy iconCopydownload iconDownload
const uuid = uuid();
const eventSource = new EventSource(`/register/${uuid}`);
eventSource.addEventListener('message', response => {
  //handle the response from the server
  //response.data contains the data line 
}, false);

Broadcasting events

copy iconCopydownload iconDownload
@Service
public class DataEmitterService {
  private final SseEventBus eventBus;
  public DataEmitterService(SseEventBus eventBus) {
    this.eventBus = eventBus;
  }

  public void broadcastEvent() {
    this.eventBus.handleEvent(SseEvent.ofData("some useful data"));
  }

}

Maven

copy iconCopydownload iconDownload
  <dependency>
    <groupId>ch.rasc</groupId>
    <artifactId>sse-eventbus</artifactId>
    <version>1.1.9</version>
  </dependency>  

1.1.5 - January 7, 2018

copy iconCopydownload iconDownload
@Component
public class CustomSubscriptionRegistry extends DefaultSubscriptionRegistry {

  @Override
  public boolean isClientSubscribedToEvent(String clientId, String eventName) {
    return super.isClientSubscribedToEvent(clientId, eventName)
        || super.isClientSubscribedToEvent(clientId, "*");
  }
}  

1.1.2 - July 16, 2017

copy iconCopydownload iconDownload
boolean completeAfterMessage = true;
eventBus.createSseEmitter("client1", 180_000L, true, completeAfterMessage, "event1", "event2");

1.0.1 - March 31, 2017

copy iconCopydownload iconDownload
SseEvent.builder().addExcludeClientId("2")
      .event("eventName")
      .data("payload")
      .build();

Community Discussions

Trending Discussions on Pub Sub
  • Build JSON content in R according Google Cloud Pub Sub message format
  • BigQuery Table a Pub Sub Topic not working in Apache Beam Python SDK? Static source to Streaming Sink
  • Pub Sub Lite topics with Peak Capacity Throughput option
  • How do I add permissions to a NATS User to allow the User to query & create Jestream keyvalue stores?
  • MSK vs SQS + SNS
  • Dataflow resource usage
  • Run code on Python Flask AppEngine startup in GCP
  • Is there a way to listen for updates on multiple Google Classroom Courses using Pub Sub?
  • Flow.take(ITEM_COUNT) returning all the elements rather then specified amount of elements
  • Wrapping Pub-Sub Java API in Akka Streams Custom Graph Stage
Trending Discussions on Pub Sub

QUESTION

Build JSON content in R according Google Cloud Pub Sub message format

Asked 2022-Apr-16 at 09:59

In R, I want to build json content according this Google Cloud Pub Sub message format: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage

It have to respect :

{
  "data": string,
  "attributes": {
    string: string,
    ...
  },
  "messageId": string,
  "publishTime": string,
  "orderingKey": string
}

The message built will be readed from this Python code:

def pubsub_read(data, context):
    '''This function is executed from a Cloud Pub/Sub'''
    message = base64.b64decode(data['data']).decode('utf-8')
    file_name = data['attributes']['file_name']

This following R code builds a R dataframe and converts it to json content:

library(jsonlite)
data="Hello World!"
df <- data.frame(data)
attributes <- data.frame(file_name=c('gfs_data_temp_FULL.csv'))
df$attributes <- attributes

msg <- df %>%
    toJSON(auto_unbox = TRUE, dataframe = 'columns', pretty = T) %>%
    # Pub/Sub expects a base64 encoded string
    googlePubsubR::msg_encode() %>%
    googlePubsubR::PubsubMessage()

It seems good but when I visualise it with a json editor :

enter image description here

indexes are added.

Additionally there is the message content: enter image description here

I dont'sure it respects Google Cloud Pub Sub message format...

ANSWER

Answered 2022-Apr-16 at 09:59

Not sure why, but replacing the dataframe by a list seems to work:

library(jsonlite)

df = list(data = "Hello World")
attributes <- list(file_name=c('toto.csv'))
df$attributes <- attributes

df %>%
  toJSON(auto_unbox = TRUE, simplifyVector=TRUE, dataframe = 'columns', pretty = T)

Output:

{
  "data": "Hello World",
  "attributes": {
    "file_name": "toto.csv"
  }
} 

Source https://stackoverflow.com/questions/71892778

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install sse-eventbus

Enable support by adding @EnableSseEventBus to a Spring application. Create a controller that handles the SSE requests and returns a SseEmitter. Each client has to provide an id that identifies this client. The controller then registers the client in the eventBus with the method registerClient and subscribes it to events with the subscribe method. The SseEventBus class contains a convenient method createSseEmitter that does all of this.
On the client side an application interacts with the EventSource object. This object is responsible for sending the SSE request to the server and calling listeners the application registered on this object. As mentioned before the client has to send an id that should be unique among all the clients. A simple way is to use libraries like node-uuid that generates UUIDs.

Support

SSE is supported in most browsers. The notable exceptions are the browsers from Microsoft IE and Edge. http://caniuse.com/#feat=eventsource. Fortunately it is possible to polyfill the SSE support where it's missing.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.