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
- Host: GitHub
- URL: https://github.com/abhirockzz/redis-websocket-javaee
- Owner: abhirockzz
- License: apache-2.0
- Created: 2017-03-20T17:29:46.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-22T09:04:04.000Z (about 8 years ago)
- Last Synced: 2025-03-24T00:24:32.867Z (about 2 months ago)
- Topics: cdi, data-structures, ejb, javaee7, jedis, redis, sorted-sets, websocket
- Language: Java
- Size: 25.4 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)

## 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