This is an automated email from the ASF dual-hosted git repository. sjwiesman pushed a commit to branch dev in repository https://gitbox.apache.org/repos/asf/flink-statefun-playground.git
The following commit(s) were added to refs/heads/dev by this push: new 638e9e2 [release] Update to v3.1.0 638e9e2 is described below commit 638e9e24732a772fbdea4d2afce7b2c966e1cfc2 Author: Tzu-Li (Gordon) Tai <tzuli...@apache.org> AuthorDate: Mon Aug 30 16:13:28 2021 +0800 [release] Update to v3.1.0 --- deployments/aws-lambda/pom.xml | 4 +- .../k8s/04-statefun/01-statefun-runtime.yaml | 4 +- java/greeter/docker-compose.yml | 4 +- java/greeter/pom.xml | 4 +- java/shopping-cart/docker-compose.yml | 4 +- java/shopping-cart/pom.xml | 4 +- .../playground/java/shoppingcart/Messages.java | 82 ++++++++++------------ .../playground/java/shoppingcart/StockFn.java | 7 +- .../java/shoppingcart/UserShoppingCartFn.java | 11 +-- java/showcase/pom.xml | 4 +- python/greeter/docker-compose.yml | 4 +- python/greeter/requirements.txt | 2 +- python/showcase/docker-compose.yml | 4 +- python/showcase/setup.py | 4 +- 14 files changed, 69 insertions(+), 73 deletions(-) diff --git a/deployments/aws-lambda/pom.xml b/deployments/aws-lambda/pom.xml index 63d9f6a..69e2526 100644 --- a/deployments/aws-lambda/pom.xml +++ b/deployments/aws-lambda/pom.xml @@ -22,11 +22,11 @@ under the License. <groupId>org.apache.flink</groupId> <artifactId>aws-lambda-example</artifactId> - <version>3.0.0</version> + <version>3.1.0</version> <packaging>jar</packaging> <properties> - <statefun.version>3.0.0</statefun.version> + <statefun.version>3.1.0</statefun.version> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> diff --git a/deployments/k8s/04-statefun/01-statefun-runtime.yaml b/deployments/k8s/04-statefun/01-statefun-runtime.yaml index 82e8d72..4503e6f 100644 --- a/deployments/k8s/04-statefun/01-statefun-runtime.yaml +++ b/deployments/k8s/04-statefun/01-statefun-runtime.yaml @@ -98,7 +98,7 @@ spec: spec: containers: - name: master - image: apache/flink-statefun:3.0.0 + image: apache/flink-statefun:3.1.0 imagePullPolicy: IfNotPresent env: - name: ROLE @@ -157,7 +157,7 @@ spec: spec: containers: - name: worker - image: apache/flink-statefun:3.0.0 + image: apache/flink-statefun:3.1.0 imagePullPolicy: IfNotPresent env: - name: ROLE diff --git a/java/greeter/docker-compose.yml b/java/greeter/docker-compose.yml index 77555c5..e4d2f21 100644 --- a/java/greeter/docker-compose.yml +++ b/java/greeter/docker-compose.yml @@ -35,7 +35,7 @@ services: ############################################################### statefun-manager: - image: apache/flink-statefun:3.0.0-java11 + image: apache/flink-statefun:3.1.0-java11 expose: - "6123" ports: @@ -47,7 +47,7 @@ services: - ./module.yaml:/opt/statefun/modules/greeter/module.yaml statefun-worker: - image: apache/flink-statefun:3.0.0-java11 + image: apache/flink-statefun:3.1.0-java11 expose: - "6121" - "6122" diff --git a/java/greeter/pom.xml b/java/greeter/pom.xml index 6ad0e01..6d18dd0 100644 --- a/java/greeter/pom.xml +++ b/java/greeter/pom.xml @@ -22,11 +22,11 @@ under the License. <groupId>org.apache.flink</groupId> <artifactId>greeter-functions-app</artifactId> - <version>3.0.0</version> + <version>3.1.0</version> <packaging>jar</packaging> <properties> - <statefun.version>3.0.0</statefun.version> + <statefun.version>3.1.0</statefun.version> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> diff --git a/java/shopping-cart/docker-compose.yml b/java/shopping-cart/docker-compose.yml index 0deba9c..2be9b39 100644 --- a/java/shopping-cart/docker-compose.yml +++ b/java/shopping-cart/docker-compose.yml @@ -35,7 +35,7 @@ services: ############################################################### statefun-manager: - image: apache/flink-statefun:3.0.0 + image: apache/flink-statefun:3.1.0-java11 expose: - "6123" ports: @@ -47,7 +47,7 @@ services: - ./module.yaml:/opt/statefun/modules/shopping-cart/module.yaml statefun-worker: - image: apache/flink-statefun:3.0.0 + image: apache/flink-statefun:3.1.0-java11 expose: - "6121" - "6122" diff --git a/java/shopping-cart/pom.xml b/java/shopping-cart/pom.xml index a5a51ad..35471a2 100644 --- a/java/shopping-cart/pom.xml +++ b/java/shopping-cart/pom.xml @@ -22,11 +22,11 @@ under the License. <artifactId>shopping-cart</artifactId> <groupId>org.apache.flink</groupId> - <version>3.0.0</version> + <version>3.1.0</version> <packaging>jar</packaging> <properties> - <statefun.version>3.0.0</statefun.version> + <statefun.version>3.1.0</statefun.version> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> <untertow.version>1.4.18.Final</untertow.version> diff --git a/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/Messages.java b/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/Messages.java index cb56729..a71c334 100644 --- a/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/Messages.java +++ b/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/Messages.java @@ -21,7 +21,6 @@ package org.apache.flink.statefun.playground.java.shoppingcart; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; - import org.apache.flink.statefun.sdk.java.TypeName; import org.apache.flink.statefun.sdk.java.types.SimpleType; import org.apache.flink.statefun.sdk.java.types.Type; @@ -30,7 +29,6 @@ public class Messages { private static final ObjectMapper mapper = new ObjectMapper(); - /* ingress -> user-shopping-cart */ public static final Type<AddToCart> ADD_TO_CART = SimpleType.simpleImmutableTypeFrom( @@ -62,10 +60,10 @@ public class Messages { /* ingress -> stock */ /* user-shopping-cart -> stock */ public static final Type<RestockItem> RESTOCK_ITEM_TYPE = - SimpleType.simpleImmutableTypeFrom( - TypeName.typeNameFromString("com.example/RestockItem"), - mapper::writeValueAsBytes, - bytes -> mapper.readValue(bytes, RestockItem.class)); + SimpleType.simpleImmutableTypeFrom( + TypeName.typeNameFromString("com.example/RestockItem"), + mapper::writeValueAsBytes, + bytes -> mapper.readValue(bytes, RestockItem.class)); public static class ClearCart { private final String userId; @@ -74,23 +72,21 @@ public class Messages { public ClearCart(@JsonProperty("userId") String userId) { this.userId = userId; } -/* Messages.AddToCart add = new Messages.AddToCart("1", "2", 3); - String addJson = mapper.writeValueAsString(add); - System.out.println(addJson); + /* Messages.AddToCart add = new Messages.AddToCart("1", "2", 3); + String addJson = mapper.writeValueAsString(add); + System.out.println(addJson); - String json = "{\"userId\":1, \"quantity\":3, \"itemId\":2}"; + String json = "{\"userId\":1, \"quantity\":3, \"itemId\":2}"; - Messages.AddToCart addReceived = mapper.readValue(json.getBytes(), Messages.AddToCart.class); - System.out.println(addReceived);*/ + Messages.AddToCart addReceived = mapper.readValue(json.getBytes(), Messages.AddToCart.class); + System.out.println(addReceived);*/ public String getUserId() { return userId; } @Override public String toString() { - return "ClearCart{" + - "userId='" + userId + '\'' + - '}'; + return "ClearCart{" + "userId='" + userId + '\'' + '}'; } } @@ -108,9 +104,7 @@ public class Messages { @Override public String toString() { - return "Checkout{" + - "userId='" + userId + '\'' + - '}'; + return "Checkout{" + "userId='" + userId + '\'' + '}'; } } @@ -134,10 +128,7 @@ public class Messages { @Override public String toString() { - return "Receipt{" + - "userId='" + userId + '\'' + - ", details='" + details + '\'' + - '}'; + return "Receipt{" + "userId='" + userId + '\'' + ", details='" + details + '\'' + '}'; } } @@ -146,7 +137,8 @@ public class Messages { private final int quantity; @JsonCreator - public RestockItem(@JsonProperty("itemId") String itemId, @JsonProperty("quantity") int quantity) { + public RestockItem( + @JsonProperty("itemId") String itemId, @JsonProperty("quantity") int quantity) { this.itemId = itemId; this.quantity = quantity; } @@ -161,10 +153,7 @@ public class Messages { @Override public String toString() { - return "RestockItem{" + - "itemId='" + itemId + '\'' + - ", quantity=" + quantity + - '}'; + return "RestockItem{" + "itemId='" + itemId + '\'' + ", quantity=" + quantity + '}'; } } @@ -175,7 +164,9 @@ public class Messages { @JsonCreator public AddToCart( - @JsonProperty("userId") String userId, @JsonProperty("itemId") String itemId, @JsonProperty("quantity") int quantity) { + @JsonProperty("userId") String userId, + @JsonProperty("itemId") String itemId, + @JsonProperty("quantity") int quantity) { this.userId = userId; this.itemId = itemId; this.quantity = quantity; @@ -195,11 +186,16 @@ public class Messages { @Override public String toString() { - return "AddToCart{" + - "userId='" + userId + '\'' + - ", itemId='" + itemId + '\'' + - ", quantity=" + quantity + - '}'; + return "AddToCart{" + + "userId='" + + userId + + '\'' + + ", itemId='" + + itemId + + '\'' + + ", quantity=" + + quantity + + '}'; } } @@ -207,20 +203,19 @@ public class Messages { // Internal messages // --------------------------------------------------------------------- - /* user-shopping-cart -> stock */ public static final Type<RequestItem> REQUEST_ITEM_TYPE = - SimpleType.simpleImmutableTypeFrom( - TypeName.typeNameFromString("com.example/RequestItem"), - mapper::writeValueAsBytes, - bytes -> mapper.readValue(bytes, RequestItem.class)); + SimpleType.simpleImmutableTypeFrom( + TypeName.typeNameFromString("com.example/RequestItem"), + mapper::writeValueAsBytes, + bytes -> mapper.readValue(bytes, RequestItem.class)); /* stock -> user-shopping-cart */ public static final Type<ItemAvailability> ITEM_AVAILABILITY_TYPE = - SimpleType.simpleImmutableTypeFrom( - TypeName.typeNameFromString("com.example/ItemAvailability"), - mapper::writeValueAsBytes, - bytes -> mapper.readValue(bytes, ItemAvailability.class)); + SimpleType.simpleImmutableTypeFrom( + TypeName.typeNameFromString("com.example/ItemAvailability"), + mapper::writeValueAsBytes, + bytes -> mapper.readValue(bytes, ItemAvailability.class)); public static class RequestItem { private final int quantity; @@ -251,7 +246,8 @@ public class Messages { private final int quantity; @JsonCreator - public ItemAvailability(@JsonProperty("status") Status status, @JsonProperty("quantity")int quantity) { + public ItemAvailability( + @JsonProperty("status") Status status, @JsonProperty("quantity") int quantity) { this.status = status; this.quantity = quantity; } diff --git a/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/StockFn.java b/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/StockFn.java index e0ce4fe..340d954 100644 --- a/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/StockFn.java +++ b/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/StockFn.java @@ -22,7 +22,6 @@ import static org.apache.flink.statefun.playground.java.shoppingcart.Messages.It import java.util.Optional; import java.util.concurrent.CompletableFuture; - import org.apache.flink.statefun.sdk.java.Address; import org.apache.flink.statefun.sdk.java.AddressScopedStorage; import org.apache.flink.statefun.sdk.java.Context; @@ -31,7 +30,6 @@ import org.apache.flink.statefun.sdk.java.TypeName; import org.apache.flink.statefun.sdk.java.ValueSpec; import org.apache.flink.statefun.sdk.java.message.Message; import org.apache.flink.statefun.sdk.java.message.MessageBuilder; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,8 +74,9 @@ final class StockFn implements StatefulFunction { } final Optional<Address> caller = context.caller(); - if(caller.isPresent()){ - context.send( MessageBuilder.forAddress(caller.get()) + if (caller.isPresent()) { + context.send( + MessageBuilder.forAddress(caller.get()) .withCustomType(ITEM_AVAILABILITY_TYPE, itemAvailability) .build()); } else { diff --git a/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/UserShoppingCartFn.java b/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/UserShoppingCartFn.java index 3a79a8d..ef34d73 100644 --- a/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/UserShoppingCartFn.java +++ b/java/shopping-cart/src/main/java/org/apache/flink/statefun/playground/java/shoppingcart/UserShoppingCartFn.java @@ -27,7 +27,6 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; - import org.apache.flink.statefun.sdk.java.Address; import org.apache.flink.statefun.sdk.java.AddressScopedStorage; import org.apache.flink.statefun.sdk.java.Context; @@ -80,7 +79,7 @@ final class UserShoppingCartFn implements StatefulFunction { // ItemAvailability event comes from the Stock function and contains the itemId as the // caller id final Optional<Address> caller = context.caller(); - if(caller.isPresent()){ + if (caller.isPresent()) { basket.add(caller.get().id(), availability.getQuantity()); } else { throw new IllegalStateException("There should always be a caller in this example"); @@ -107,7 +106,8 @@ final class UserShoppingCartFn implements StatefulFunction { .ifPresent( basket -> { for (Map.Entry<String, Integer> entry : basket.getEntries()) { - Messages.RestockItem restockItem = new Messages.RestockItem(entry.getKey(), entry.getValue()); + Messages.RestockItem restockItem = + new Messages.RestockItem(entry.getKey(), entry.getValue()); Message restockCommand = MessageBuilder.forAddress(StockFn.TYPE, entry.getKey()) .withCustomType(Messages.RESTOCK_ITEM_TYPE, restockItem) @@ -145,7 +145,8 @@ final class UserShoppingCartFn implements StatefulFunction { LOG.info("{}", items); final Messages.Receipt receipt = new Messages.Receipt(context.self().id(), items); - final EgressMessage egressMessage = KafkaEgressMessage.forEgress(Identifiers.RECEIPT_EGRESS) + final EgressMessage egressMessage = + KafkaEgressMessage.forEgress(Identifiers.RECEIPT_EGRESS) .withTopic(Identifiers.RECEIPT_TOPICS) .withUtf8Key(context.self().id()) .withValue(Messages.RECEIPT_TYPE, receipt) @@ -198,7 +199,7 @@ final class UserShoppingCartFn implements StatefulFunction { } @JsonProperty("basket") - public Map<String, Integer> getBasketContent(){ + public Map<String, Integer> getBasketContent() { return basket; }; diff --git a/java/showcase/pom.xml b/java/showcase/pom.xml index c175c25..9b56543 100644 --- a/java/showcase/pom.xml +++ b/java/showcase/pom.xml @@ -22,11 +22,11 @@ under the License. <groupId>org.apache.flink</groupId> <artifactId>statefun-java-showcase</artifactId> - <version>3.0.0</version> + <version>3.1.0</version> <packaging>jar</packaging> <properties> - <statefun.version>3.0.0</statefun.version> + <statefun.version>3.1.0</statefun.version> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> diff --git a/python/greeter/docker-compose.yml b/python/greeter/docker-compose.yml index 6ccf879..57c8be4 100644 --- a/python/greeter/docker-compose.yml +++ b/python/greeter/docker-compose.yml @@ -34,7 +34,7 @@ services: ############################################################### statefun-manager: - image: apache/flink-statefun:3.0.0 + image: apache/flink-statefun:3.1.0-java11 expose: - "6123" ports: @@ -46,7 +46,7 @@ services: - ./module.yaml:/opt/statefun/modules/greeter/module.yaml statefun-worker: - image: apache/flink-statefun:3.0.0 + image: apache/flink-statefun:3.1.0-java11 expose: - "6121" - "6122" diff --git a/python/greeter/requirements.txt b/python/greeter/requirements.txt index 0c22eb6..cafef02 100644 --- a/python/greeter/requirements.txt +++ b/python/greeter/requirements.txt @@ -15,4 +15,4 @@ # limitations under the License. aiohttp -apache-flink-statefun==3.0.0 +apache-flink-statefun==3.1.0 diff --git a/python/showcase/docker-compose.yml b/python/showcase/docker-compose.yml index 276b62e..4b6a001 100644 --- a/python/showcase/docker-compose.yml +++ b/python/showcase/docker-compose.yml @@ -24,7 +24,7 @@ services: ############################################################### statefun-manager: - image: apache/flink-statefun:3.0.0 + image: apache/flink-statefun:3.1.0-java11 expose: - "6123" ports: @@ -36,7 +36,7 @@ services: - ./module.yaml:/opt/statefun/modules/greeter/module.yaml statefun-worker: - image: apache/flink-statefun:3.0.0 + image: apache/flink-statefun:3.1.0-java11 expose: - "6121" - "6122" diff --git a/python/showcase/setup.py b/python/showcase/setup.py index af36e68..737a34e 100644 --- a/python/showcase/setup.py +++ b/python/showcase/setup.py @@ -27,7 +27,7 @@ with io.open(os.path.join(this_directory, 'README.md'), 'r', encoding='utf-8') a setup( name='showcase', - version='3.0.0', + version='3.1.0', packages=["showcase"], url='https://github.com/apache/flink-statefun-playground', license='https://www.apache.org/licenses/LICENSE-2.0', @@ -38,7 +38,7 @@ setup( long_description=long_description, long_description_content_type='text/markdown', install_requires=['protobuf>=3.11.3,<4.0.0', - 'apache-flink-statefun==3.0.0', + 'apache-flink-statefun==3.1.0', 'aiohttp'], tests_require=['pytest'], python_requires='>=3.8',