Skip to content

Commit

Permalink
Prepare for migration to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
andrebrait committed Apr 21, 2021
1 parent c2bb746 commit 8045703
Show file tree
Hide file tree
Showing 60 changed files with 478 additions and 360 deletions.
64 changes: 46 additions & 18 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,58 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Maven Package
name: Release

on:
release:
types: [created]
push:
tags:
- v*

jobs:
build:

name: Release to Maven Central
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 1.8
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
distribution: adopt
java-version: 8
check-latest: true
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
settings-path: ${{ github.workspace }}
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
- name: Build and publish to Maven Central
run: >
mvn
--batch-mode
--activate-profiles release
--file pom.xml
--settings $GITHUB_WORKSPACE/settings.xml
clean
deploy
-Dmaven.install.skip=true
env:
GITHUB_TOKEN: ${{ github.token }}
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
- name: Create an automatic release
uses: marvinpinto/[email protected]
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
- LICENSE.txt
- README.md
- *.jar
- *.jar.asc
37 changes: 27 additions & 10 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven
name: CI

on:
push:
branches: [ master ]
branches:
- master
pull_request:
branches: [ master ]
branches:
- master

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 8
check-latest: true
settings-path: ${{ github.workspace }}
- name: Cache Maven packages
uses: actions/cache@v2
with:
java-version: 1.8
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
- name: Build with Maven
run: mvn -B package --file pom.xml
run: >
mvn
--batch-mode
--activate-profiles ci
--file pom.xml
--settings $GITHUB_WORKSPACE/settings.xml
clean
verify
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
# Other stuff
*.bat
target/

*.versionsBackup
*.releaseBackup
release.properties
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,25 @@ Persistent Stateful Actor System

### Current released version

[ ![Download](https://api.bintray.com/packages/elasticsoftwarefoundation/maven/org.elasticsoftware.elasticactors/images/download.svg) ](https://bintray.com/elasticsoftwarefoundation/maven/org.elasticsoftware.elasticactors/_latestVersion)
![CI](https://github.com/elasticsoftwarefoundation/elasticactors/workflows/CI/badge.svg)
[![License: Apache 2](https://img.shields.io/badge/LICENSE-Apache2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.txt)
[![Maven Central](https://img.shields.io/maven-central/v/org.elasticsoftwarefoundation/elasticactors.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22org.elasticsoftwarefoundation%22%20AND%20a:%22elasticactors%22)
[![Download](https://api.bintray.com/packages/elasticsoftwarefoundation/maven/org.elasticsoftware.elasticactors/images/download.svg) ](https://bintray.com/elasticsoftwarefoundation/maven/org.elasticsoftware.elasticactors/_latestVersion)

### Add Elastic Actors to your Project

repository:
```xml
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>elasticsoftwarefoundation</id>
<name>bintray</name>
<url>http://dl.bintray.com/elasticsoftwarefoundation/maven</url>
</repository>
</repositories>
```
minimal dependency:
```xml
<dependency>
<groupId>org.elasticsoftware.elasticactors</groupId>
<groupId>org.elasticsoftwarefoundation.elasticactors</groupId>
<artifactId>elasticactors-api</artifactId>
<version>${elasticactors.version}</version>
</dependency>
```
convenient base classes inclusing a Jackson 2 based serialization framework:
```xml
<dependency>
<groupId>org.elasticsoftware.elasticactors</groupId>
<groupId>org.elasticsoftwarefoundation.elasticactors</groupId>
<artifactId>elasticactors-base</artifactId>
<version>${elasticactors.version}</version>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.elasticsoftware.elasticactors</groupId>
<groupId>org.elasticsoftwarefoundation.elasticactors</groupId>
<artifactId>elasticactors-parent</artifactId>
<version>2.7.1-SNAPSHOT</version>
</parent>
Expand Down
10 changes: 7 additions & 3 deletions api/src/main/java/org/elasticsoftware/elasticactors/Actor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
import org.elasticsoftware.elasticactors.serialization.SerializationFramework;
import org.elasticsoftware.elasticactors.state.NullActorState;

import java.lang.annotation.*;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Use this annotation to mark a class as an Actor. The runtime uses this to determine the
Expand All @@ -41,14 +45,14 @@
/**
* The class that implements the {@link ActorState} for this Actor
*
* @return
* @return the class that implements the {@link ActorState} for this Actor
*/
Class<? extends ActorState> stateClass() default NullActorState.class;

/**
* The {@link SerializationFramework} used to serialize and deserialize the {@link ActorState}
*
* @return
* @return the {@link SerializationFramework} used to serialize and deserialize the {@link ActorState}
*/
Class<? extends SerializationFramework> serializationFramework() default NoopSerializationFramework.class;
}
39 changes: 20 additions & 19 deletions api/src/main/java/org/elasticsoftware/elasticactors/ActorRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
* can be obtained by using the sender field from {@link ElasticActor#onReceive(ActorRef, Object)} or by getting an
* {@link ActorRef} from the various methods on {@link ActorSystem}.
*
* An {@link ActorRef} in serialized form looks as follows:<br/>
* An {@link ActorRef} in serialized form looks as follows:<br>
*
* (Normal) Actors: actor://<cluster>/<actorSystem>/shards/<shardId>/<actorId><br/>
* Service Actors: actor://<cluster>/<actorSystem>/nodes/<nodeId>/<serviceId><br/>
* Temporary Actors: actor://<cluster>/<actorSystem>/nodes/<nodeId>/<actorId><br/>
* (Normal) Actors: {@code actor://<cluster>/<actorSystem>/shards/<shardId>/<actorId>}<br>
* Service Actors: {@code actor://<cluster>/<actorSystem>/nodes/<nodeId>/<serviceId>}<br>
* Temporary Actors: {@code actor://<cluster>/<actorSystem>/nodes/<nodeId>/<actorId>}<br>
*
*
* @see ActorSystem#actorFor(String)
Expand All @@ -44,9 +44,9 @@ public interface ActorRef {
String getActorCluster();
/**
* The path of an actor is the Shard (or Node) where the actor is located. It looks like:
* <actorSystem>/shards/<shardId> or <actorSystem>/nodes/<nodeId>
* {@code <actorSystem>/shards/<shardId>} or {@code <actorSystem>/nodes/<nodeId>}
*
* @return the actor path
* @return the actor path as a string
*/
String getActorPath();

Expand Down Expand Up @@ -85,19 +85,20 @@ public interface ActorRef {
*
* @param message the message to send (needs to be annotated with {@link org.elasticsoftware.elasticactors.serialization.Message}
* @param responseType the expected message type of the response
* @return a CompletableFuture that completes with the response message
* @param <T> the expected message type of the response
* @return a {@link CompletionStage} that completes with the response message
*/
<T> CompletionStage<T> ask(Object message, Class<T> responseType);

/**
* Send a message to an {@link ElasticActor} and request a response. when {@param persistOnResponse} is {@link Boolean#TRUE}
* Send a message to an {@link ElasticActor} and request a response. When {@code persistOnResponse} is {@link Boolean#TRUE}
* the calling actor's state (if it's a persistent actor) will be saved.
*
* @param message
* @param responseType
* @param persistOnResponse
* @param <T>
* @return
* @param message the message to send (needs to be annotated with {@link org.elasticsoftware.elasticactors.serialization.Message}
* @param responseType the expected message type of the response
* @param persistOnResponse is true, the calling actor's state (if it's a persistent actor) will be saved
* @param <T> the expected message type of the response
* @return a {@link CompletionStage} that completes with the response message
*/
<T> CompletionStage<T> ask(Object message, Class<T> responseType, Boolean persistOnResponse);

Expand All @@ -111,21 +112,21 @@ public interface ActorRef {
boolean isLocal();

/**
* Returns a view of the referenced Actor as a {@link Publisher} of messages of type T. When this method is called
* Returns a view of the referenced Actor as a {@link Publisher} of messages of type {@code T}. When this method is called
* from within a {@link ActorContext} (i.e. when executing {@link ElasticActor#onReceive(ActorRef, Object)} or any
* of the other {@link ElasticActor} lifecycle methods) the supplied {@link org.reactivestreams.Subscriber} should
* have been obtained by calling {@link ElasticActor#asSubscriber(Class)} on the calling actor.
* have been obtained by calling {@link ElasticActor#asSubscriber(Class)} on the calling actor.<br><br>
*
* Because the {@link org.reactivestreams.Subscription} is persistent, the framework will call
* {@link ElasticActor#asSubscriber(Class)} when deserializing the state of the calling actor.
* {@link ElasticActor#asSubscriber(Class)} when deserializing the state of the calling actor.<br><br>
*
* It is also required for the supplied {@link org.reactivestreams.Subscriber} to extend {@link TypedSubscriber} when
* called within a {@link ActorContext} to ensure that the implementation has access to the correct
* {@link SubscriberContext}
*
* @param messageClass
* @param <T>
* @return
* @param messageClass the message type the actor is expected to publish
* @param <T> the message type the actor is expected to publish
* @return a view of the referenced Actor as a {@link Publisher} of messages of type {@code T}
*/
<T> Publisher<T> publisherOf(Class<T> messageClass);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@
*/
public interface ActorState<Body> {
/**
* The body (the actual state)
*
* @return the body (the actual state)
* @return the body (the actual state)
*/
Body getBody();

/**
* Returns the type of the SerializationFramework that should be used to serialize this state class
* The type of the SerializationFramework that should be used to serialize this state class
*
* @return
* @return the type of the SerializationFramework that should be used to serialize this state class
*/
Class<? extends SerializationFramework> getSerializationFramework();
}
Expand Down
Loading

0 comments on commit 8045703

Please sign in to comment.