Skip to content

Commit

Permalink
Move InMemorySubscriber from L2 communication module to L3 client mo… (
Browse files Browse the repository at this point in the history
…#158)

The InMemorySubscriber actually was implementing the client-side of the uSubscription flow by talking to usubscription service, registering a listener (to receive published messages), and setting up a notifier to receive subscription changes. The only L2 item for pub/sub (subscriber) flow was to register a listener with the transport so there is no need to add a wrapper to do that.
This change then also implements all the other remaining usubscription client side APIs for developers to use and removes the L2 Subscriber to avoid confusion with this InMemoryUSubscriptionClient implementation. The uProtocol client-side implementations will now reside in the client folder of up-java (ex. uDiscovery & uTwin).
  • Loading branch information
Steven Hartley committed Jul 16, 2024
1 parent b71c1ab commit 39c4d05
Show file tree
Hide file tree
Showing 11 changed files with 1,005 additions and 217 deletions.
33 changes: 22 additions & 11 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

== Overview

This library implements the https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/languages.adoc[uProtocol Language Specific Library Requirements] for Java defined in https://github.com/eclipse-uprotocol/uprotocol-spec/tree/main[uProtocol Specifications]. The library is organized into packages that are described in <<sdk-packages>> below. Each package contains a README.adoc file that describes the purpose of the package and how to use it.
This library implements the https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/languages.adoc[uProtocol Language Specific Library Requirements] for Java defined in https://github.com/eclipse-uprotocol/uprotocol-spec/tree/main[uProtocol Specifications]. The library is organized into packages that are described in <<sdk-packages>> below and organized by the layers of the protocol.

Each package contains a README.adoc file that describes the purpose of the package and how to use it.

The module contains the factory methods, serializers, and validators for all data types defined in the specifications, and any data models that either haven't or couldn't be defined in up-core-api yet.

Expand All @@ -25,26 +27,35 @@ To pull the Library from maven central, setting ${uprotocol.version} to the late
=== Using The Library

.SDK Packages
[#sdk-packages,width=100%,cols="20%,80%",options="header"]
[#sdk-packages,width=100%,cols="1,2,5",options="header"]
|===

| Package | Purpose
| Package | Protocol Layer | Purpose

| xref:src/main/java/org/eclipse/uprotocol/communication/README.adoc[`*client*`]
| https://github.com/eclipse-uprotocol/up-spec/tree/main/up-l3[Application Layer (uP-L3)]
| Top level client-facing interfaces to communication with USubscription, UDiscovery, and UTwin services.

| xref:src/main/java/org/eclipse/uprotocol/communication/README.adoc[`*communication*`]
| Top level client-facing https://github.com/eclipse-uprotocol/up-spec/tree/main/up-l2[communication layer (uP-L2)] interfaces that applications and services use to implement the publisher/subscriber, notification, and RPC patterns on top of the transport layer (uTransport) API.
| https://github.com/eclipse-uprotocol/up-spec/tree/main/up-l2[communication layer (uP-L2)]
| Common implementation of communication messaging patterns (publisher, subscriber, Rpcclient, RpcServer, etc..) tha t is build on top of the L1 transport interface (see below)

| link:src/main/java/org/eclipse/uprotocol/uri/README.adoc[`*uuri*`]
| Builders, validators, and serializers for uProtocol addressing scheme (UUri).
| link:src/main/java/org/eclipse/uprotocol/transport/README.adoc[`*transport*`]
| https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/README.adoc[Transport Layer (uP-L1)]
| Interface and data model for how to send() and receive() messages in a common way across various transport technologies (ex. zenoh, mqtt, http, etc...). the interface is implemented by transports (ex. up-transport-android-java), and the interface is then used to build the uProtocol layer 2 communication layer implementation.

| link:src/main/java/org/eclipse/uprotocol/uri/README.adoc[`*uuri*`]
| Basics
| uProtocol addressing scheme (UUri) builders, validators, and serializers.

| link:src/main/java/org/eclipse/uprotocol/uuid/README.adoc[`*uuid*`]
| Identifier used to uniquely identify (and timestamp) messages that are sent

| link:src/main/java/org/eclipse/uprotocol/transport/README.adoc[`*transport*`]
| https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/README.adoc[uP-L1 Transport Layer] interface and data model that wraps communication middlewares like zenoh, mqtt, http, etc... into a thin and simple to use transport interface. This model is used by the communication layer (uP-L2) to send and receive messages and transports are expected to implement the link:src/main/java/org/eclipse/uprotocol/transport/UTransport.java[uTransport] interface.
| link:src/main/java/org/eclipse/uprotocol/uuid/README.adoc[`*uuid*`]
| Basics
| uProtocol unique identifier builders, validators, and serializers.

| link:src/main/java/org/eclipse/uprotocol/cloudevent/README.adoc[`*cloudevent*`]
| A representation of uProtocol messages used in older versions of the specifications and kept for backwards compatibility.
| Legacy
| A representation of uProtocol messages used in older versions of the specifications kept for backwards compatibility.

|===

3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<artifactId>up-java</artifactId>
<name>Java Library for uProtocol</name>
<description>Language specific uProtocol library for building and using UUri, UUID, UAttributes, UTransport, and more</description>
<version>0.1.12-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<url>https://github.com/eclipse-uprotocol/up-java/</url>

Expand Down Expand Up @@ -241,6 +241,7 @@
<include>**/uri/**</include>
<include>**/uuid/**</include>
<include>**/validation/**</include>
<include>**/client/**</include>
</includes>
</configuration>
</plugin>
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/eclipse/uprotocol/client/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Application Layer APIs (uP-L3 Interface)

The following module includes the client-facing https://github.com/eclipse-uprotocol/up-spec/tree/main/up-l3[Application Layer (uP-L3)] interfaces to communication with USubscription, UDiscovery, and UTwin services.


## uP-L3 Interfaces

.Interfaces (uP-L3 Interface)
[cols="1,1,3",options="header"]
|===
| Interface | Implementation(s) | Description

| xref:usubscription/v3/USubscriptionClient.java[*USubscriptionClient*] | xref:usubscription/v3/InMemoryUSubscriptionClient.java[InMemoryUSubscriptionClient] | Subscription Management APIs to subscribe(), unsubscribe() and fetch information from the subscription database.
|===


The module includes the interface for the client-facing APIs as well as a simple in-memory implementation that is based on the uP-L2 in-memory implementations. the term in-memory is used to indicate that the data required by the code is cached inside of the object and not persisted to a given database backend, this design is useful for embedded applications (i.e. in the vehicle) however will not scale to the multi-tenanted cloud applications.
Loading

0 comments on commit 39c4d05

Please sign in to comment.