Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java sdk update cloudevents pub/sub #620

Merged
merged 14 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'cloudevents' of https://github.com/apache/incubator-eve…
…ntmesh into java-sdk-update

� Conflicts:
�	eventmesh-examples/src/main/java/org/apache/eventmesh/tcp/common/EventMeshTestUtils.java
�	eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/MessageUtils.java
  • Loading branch information
xwm1992 committed Nov 24, 2021
commit 267d35b930c9470fa21d6569e58f500bb1ae26ce
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import static org.apache.eventmesh.tcp.common.EventMeshTestCaseTopicSet.TOPIC_PRX_WQ2ClientBroadCast;
import static org.apache.eventmesh.tcp.common.EventMeshTestCaseTopicSet.TOPIC_PRX_WQ2ClientUniCast;

import java.util.concurrent.ThreadLocalRandom;

import org.apache.eventmesh.common.protocol.tcp.Command;
import org.apache.eventmesh.common.protocol.tcp.EventMeshMessage;
import org.apache.eventmesh.common.protocol.tcp.Header;
Expand All @@ -37,36 +35,36 @@ public class EventMeshTestUtils {

public static UserAgent generateClient1() {
return UserAgent.builder()
.env("test")
.host("127.0.0.1")
.password(generateRandomString(8))
.username("PU4283")
.producerGroup("EventmeshTest-ProducerGroup")
.consumerGroup("EventmeshTest-ConsumerGroup")
.path("/data/app/umg_proxy")
.port(8362)
.subsystem("5023")
.pid(32893)
.version("2.0.11")
.idc("FT")
.build();
.env("test")
.host("127.0.0.1")
.password(generateRandomString(8))
.username("PU4283")
.producerGroup("EventmeshTest-ProducerGroup")
.consumerGroup("EventmeshTest-ConsumerGroup")
.path("/data/app/umg_proxy")
.port(8362)
.subsystem("5023")
.pid(32893)
.version("2.0.11")
.idc("FT")
.build();
}

public static UserAgent generateClient2() {
return UserAgent.builder()
.env("test")
.host("127.0.0.1")
.password(generateRandomString(8))
.username("PU4283")
.producerGroup("EventmeshTest-ProducerGroup")
.consumerGroup("EventmeshTest-ConsumerGroup")
.path("/data/app/umg_proxy")
.port(9362)
.subsystem("5017")
.pid(42893)
.version("2.0.11")
.idc("FT")
.build();
.env("test")
.host("127.0.0.1")
.password(generateRandomString(8))
.username("PU4283")
.producerGroup("EventmeshTest-ProducerGroup")
.consumerGroup("EventmeshTest-ConsumerGroup")
.path("/data/app/umg_proxy")
.port(9362)
.subsystem("5017")
.pid(42893)
.version("2.0.11")
.idc("FT")
.build();
}

public static Package syncRR() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@

import io.cloudevents.CloudEvent;
import io.cloudevents.SpecVersion;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.protocol.SubscriptionType;
import org.apache.eventmesh.common.protocol.tcp.Subscription;
import org.apache.eventmesh.common.protocol.SubscriptionItem;
import org.apache.eventmesh.common.protocol.SubscriptionMode;
import org.apache.eventmesh.common.protocol.tcp.*;
import org.apache.eventmesh.common.protocol.tcp.Package;

public class MessageUtils {
private static final int seqLength = 10;
Expand Down Expand Up @@ -93,18 +86,13 @@ public static Package asyncMessageAck(Package in) {

public static Package buildPackage(Object message, Command command) {
Package msg = new Package();
msg.setHeader(new Header(command, 0,
null, generateRandomString(seqLength)));
msg.setHeader(new Header(command, 0, null, generateRandomString(seqLength)));
if (message instanceof CloudEvent) {
msg.getHeader().putProperty(Constants.PROTOCOL_TYPE,
EventMeshCommon.CLOUD_EVENTS_PROTOCOL_NAME);
msg.getHeader().putProperty(Constants.PROTOCOL_VERSION,
((CloudEvent) message).getSpecVersion().toString());
msg.getHeader().putProperty(Constants.PROTOCOL_TYPE, EventMeshCommon.CLOUD_EVENTS_PROTOCOL_NAME);
msg.getHeader().putProperty(Constants.PROTOCOL_VERSION, ((CloudEvent) message).getSpecVersion().toString());
} else if (message instanceof EventMeshMessage) {
msg.getHeader().putProperty(Constants.PROTOCOL_TYPE,
EventMeshCommon.EM_MESSAGE_PROTOCOL_NAME);
msg.getHeader().putProperty(Constants.PROTOCOL_VERSION,
SpecVersion.V1.toString());
msg.getHeader().putProperty(Constants.PROTOCOL_TYPE, EventMeshCommon.EM_MESSAGE_PROTOCOL_NAME);
msg.getHeader().putProperty(Constants.PROTOCOL_VERSION, SpecVersion.V1.toString());
} else {
// unsupported protocol for server
return msg;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.