Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit 1e1331a

Browse files
author
Ryan Lubke
committed
Fix issues with after migration to Helidon 4
1 parent c3325cc commit 1e1331a

5 files changed

Lines changed: 95 additions & 7 deletions

File tree

k8s/optional/original-front-end.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2020,2022 Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2025 Oracle and/or its affiliates.
33
#
44
# Licensed under the Universal Permissive License v 1.0 as shown at
55
# https://oss.oracle.com/licenses/upl.
@@ -40,10 +40,10 @@ spec:
4040
resources:
4141
requests:
4242
cpu: 100m
43-
memory: 200Mi
43+
memory: 400Mi
4444
limits:
4545
cpu: 1000m
46-
memory: 200Mi
46+
memory: 400Mi
4747
ports:
4848
- containerPort: 8079
4949
securityContext:
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates.
3+
*
4+
* Licensed under the Universal Permissive License v 1.0 as shown at
5+
* https://oss.oracle.com/licenses/upl.
6+
*/
7+
8+
package com.oracle.coherence.examples.sockshop.helidon.orders;
9+
10+
import io.grpc.MethodDescriptor;
11+
import io.helidon.grpc.api.Grpc;
12+
import io.helidon.grpc.core.MarshallerSupplier;
13+
import jakarta.enterprise.context.Dependent;
14+
import jakarta.inject.Named;
15+
import jakarta.json.bind.Jsonb;
16+
import jakarta.json.bind.JsonbBuilder;
17+
import java.io.ByteArrayInputStream;
18+
import java.io.InputStream;
19+
import java.nio.charset.StandardCharsets;
20+
21+
/**
22+
* An implementation of a gRPC {@link MethodDescriptor.Marshaller} that
23+
* uses JSONB for serialization.
24+
*
25+
* @param <T> the type of value to be marshalled
26+
*/
27+
@Grpc.GrpcMarshaller
28+
public class JsonbMarshaller<T>
29+
implements MethodDescriptor.Marshaller<T>
30+
{
31+
32+
private static final Jsonb JSONB = JsonbBuilder.create();
33+
34+
private final Class<T> clazz;
35+
36+
/**
37+
* Construct {@code JsonbMarshaller} instance.
38+
*
39+
* @param clazz the type of object to marshall
40+
*/
41+
JsonbMarshaller(Class<T> clazz)
42+
{
43+
this.clazz = clazz;
44+
}
45+
46+
@Override
47+
public InputStream stream(T obj)
48+
{
49+
return new ByteArrayInputStream(JSONB.toJson(obj).getBytes(StandardCharsets.UTF_8));
50+
}
51+
52+
@Override
53+
public T parse(InputStream in)
54+
{
55+
return JSONB.fromJson(in, clazz);
56+
}
57+
58+
/**
59+
* A {@link MarshallerSupplier} implementation that supplies
60+
* instances of {@link JsonbMarshaller}.
61+
*/
62+
@Dependent
63+
@Named("jsonb")
64+
public static class Supplier
65+
implements MarshallerSupplier
66+
{
67+
@Override
68+
public <T> MethodDescriptor.Marshaller<T> get(Class<T> clazz)
69+
{
70+
return new JsonbMarshaller<>(clazz);
71+
}
72+
}
73+
}

orders/src/main/resources/application.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
#
2-
# Copyright (c) 2020, 2023 Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2025 Oracle and/or its affiliates.
33
#
44
# Licensed under the Universal Permissive License v 1.0 as shown at
55
# https://oss.oracle.com/licenses/upl.
66
#
7-
7+
grpc:
8+
client:
9+
channels:
10+
- name: "default"
11+
tls:
12+
enabled: "false"
13+
- name: "payment"
14+
tls:
15+
enabled: "false"
16+
- name: "shipping"
17+
tls:
18+
enabled: "false"
819
coherence:
920
topic:
1021
enabled: false

payment/src/main/java/com/oracle/coherence/examples/sockshop/helidon/payment/JsonbMarshaller.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* Copyright (c) 2024, Oracle and/or its affiliates.
2+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
55
* https://oss.oracle.com/licenses/upl.
66
*/
77

88
package com.oracle.coherence.examples.sockshop.helidon.payment;
99

10+
import io.helidon.grpc.api.Grpc;
1011
import jakarta.enterprise.context.Dependent;
1112
import java.io.ByteArrayInputStream;
1213
import java.io.InputStream;
@@ -28,6 +29,7 @@
2829
*
2930
* @param <T> the type of value to be marshalled
3031
*/
32+
@Grpc.GrpcMarshaller
3133
public class JsonbMarshaller<T>
3234
implements MethodDescriptor.Marshaller<T>
3335
{

shipping/src/main/java/com/oracle/coherence/examples/sockshop/helidon/shipping/JsonbMarshaller.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, Oracle and/or its affiliates.
2+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
55
* https://oss.oracle.com/licenses/upl.
@@ -9,6 +9,7 @@
99

1010

1111
import io.grpc.MethodDescriptor;
12+
import io.helidon.grpc.api.Grpc;
1213
import io.helidon.grpc.core.MarshallerSupplier;
1314
import jakarta.enterprise.context.Dependent;
1415
import jakarta.inject.Named;
@@ -25,6 +26,7 @@
2526
*
2627
* @param <T> the type of value to be marshalled
2728
*/
29+
@Grpc.GrpcMarshaller
2830
public class JsonbMarshaller<T>
2931
implements MethodDescriptor.Marshaller<T>
3032
{

0 commit comments

Comments
 (0)