An open API service indexing awesome lists of open source software.

https://github.com/abhirockzz/redis-websocket-javaee

Displays the currently trending Meetup groups based on their (live) RSVPs feed
https://github.com/abhirockzz/redis-websocket-javaee

cdi data-structures ejb javaee7 jedis redis sorted-sets websocket

Last synced: about 1 month ago
JSON representation

Displays the currently trending Meetup groups based on their (live) RSVPs feed

Awesome Lists containing this project

README

        

This is an application which displays the currently trending [Meetup](https://www.meetup.com/) groups based on their (live) RSVPs feed. It's built using [Java EE 7](http://www.oracle.com/technetwork/java/javaee/tech/index.html) (uses WebSocket client & server APIs, Singleton EJB timers and CDI events to wire things up) and [Redis](https://redis.io/)

## From Meetup to Redis

- A WebSocket client consumes live [Meetup RSVP feed](https://www.meetup.com/meetup_api/docs/stream/2/rsvps/#websockets)
- It parses each RSVP pushes the groups related data to a [Redis sorted set](https://redis.io/commands#sorted_set)
- Uses [Jedis client](https://github.com/xetorthio/jedis/) for Redis and [Jackson](https://github.com/FasterXML/jackson) for POJO based JSON binding

## From Redis to trending Meetup groups

Once the data is in a Redis sorted set

- A Singleton EJB polls Redis to get top 10 (using `Jedis#zrevrangeByScoreWithScores`) groups as per data in the RSVPs
- The information is pushed to a WebSocket endpoint via CDI
- Redis sorted set does all the heavy-lifting: Java EE helps build the solution on top of all this
- The WebSocket endpoint is consumed from within a HTML file which is in turn accessed by the end user

## To run

- clone
- start Redis instance
- change Redis connection details [here](https://github.com/abhirockzz/redis-websocket-javaee/blob/master/src/main/java/com/wordpress/simplydistributed/meetup/leaderboard/PingForLeaders.java#L42) and [here](https://github.com/abhirockzz/redis-websocket-javaee/blob/master/src/main/java/com/wordpress/simplydistributed/meetup/weboscket/client/MeetupRSVPsWebSocketClient.java#L25)
- `mvn clean install`
- deploy the WAR file in any Java EE 7 (or above) compliant container
- browse to `http:///meetup-trending/` e.g. `http://localhost:8080/meetup-trending/`

You should see something like this - **Score** represents the frequency of the group occurence in the RSVPs (popularity)

![](https://abhirockzz.files.wordpress.com/2017/03/meetup-trending-groups1.jpg)

## Credits

- Inspiration was obtained [from here](https://luvit.io/blog/redis-client.html)
- I am terrible at front end.. yes, even the most simplest ones. So I picked up things [from here](https://github.com/YuriyGuts/redis-websocket-leaderboard)

## TODOs

- CDI Producer for `Jedis` client
- find other TODOs