restfeed-server

REST Feed Server

License

License

GroupId

GroupId

org.restfeeds
ArtifactId

ArtifactId

restfeed-server
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

restfeed-server
REST Feed Server
Project URL

Project URL

https://github.com/rest-feeds/rest-feeds
Source Code Management

Source Code Management

http://github.com/rest-feeds/restfeed-server-java/tree/master

Download restfeed-server

How to add to project

<!-- https://jarcasting.com/artifacts/org.restfeeds/restfeed-server/ -->
<dependency>
    <groupId>org.restfeeds</groupId>
    <artifactId>restfeed-server</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.restfeeds/restfeed-server/
implementation 'org.restfeeds:restfeed-server:0.0.2'
// https://jarcasting.com/artifacts/org.restfeeds/restfeed-server/
implementation ("org.restfeeds:restfeed-server:0.0.2")
'org.restfeeds:restfeed-server:jar:0.0.2'
<dependency org="org.restfeeds" name="restfeed-server" rev="0.0.2">
  <artifact name="restfeed-server" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.restfeeds', module='restfeed-server', version='0.0.2')
)
libraryDependencies += "org.restfeeds" % "restfeed-server" % "0.0.2"
[org.restfeeds/restfeed-server "0.0.2"]

Dependencies

test (2)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.5.2
org.mockito : mockito-core jar 3.2.4

Project Modules

There are no modules declared in this project.

restfeed-server-java

Maven Central

Library to provide a REST Feed server endpoint in Java.

The library is written in pure Java and has no transitive dependencies.

Usage

Add this library to your pom.xml:

    <dependency>
      <groupId>org.restfeeds</groupId>
      <artifactId>restfeed-server</artifactId>
      <version>0.0.2</version>
    </dependency>

Spring Boot

Use this library when using Spring Boot:

Feel free to implement the server endpoint in a framework of your choice, such as Java EE, Quarkus, Kotlin, Spring Webflux, etc.

Further examples are highly appreciated.

Components

RestFeedEndpoint

This is the core class that handles long polling.

FeedItemRepository

You need to implement a FeedItemRepository with the database of your choice.

Feed items are stored in a repository in chronological order of addition. An SQL database is a good choice, as it provides auto incrementation of primary keys. A single partitioned Kafka topic may also be reasonable as repository, but it requires more custom client and offset handling.

Provide access to the database that stores the feed items.

Consider a good primary key that identifies a feed item and guarantees the chronological sequence of addition to the feed. An auto-incrementing database sequence is a good choice.

FeedItem

Java bean representing the data model of the returned feed items.

HTTP endpoint

You need to implement a GET endpoint in a HTTP framework of your choice.

This endpoint must call the RestFeedEndpoint#fetch method and pass the item offset and the page limit. The endpoint must support the next link.

This endpoint must support content negotiation.

NextLinkBuilder

You need to implement a NextLinkBuilder to point to your REST endpoint.

The next link must provide access to all subsequent feed items. The next link response must not include the current feed item(s).

It is up to the implementation, how this link is build and evaluated.

Versions

Version
0.0.2
0.0.1