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

[ISSUE #4166] Fix grpc AsyncPublishInstance has no push messages. #4167

Merged
merged 24 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ protected static EventMeshGrpcClientConfig initEventMeshGrpcClientConfig(final S
.build();
}

protected static CloudEvent buildCloudEvent(final Map<String, String> content) {
protected static CloudEvent buildCloudEvent(final Map<String, String> content, String topic) {
return CloudEventBuilder.v1()
.withId(UUID.randomUUID().toString())
.withSubject(ExampleConstants.EVENTMESH_GRPC_ASYNC_TEST_TOPIC)
.withSubject(topic)
.withSource(URI.create("/"))
.withDataContentType(ExampleConstants.CLOUDEVENT_CONTENT_TYPE)
.withType(EventMeshCommon.CLOUD_EVENTS_PROTOCOL_NAME)
Expand All @@ -66,10 +66,10 @@ protected static CloudEvent buildCloudEvent(final Map<String, String> content) {

}

protected static EventMeshMessage buildEventMeshMessage(final Map<String, String> content) {
protected static EventMeshMessage buildEventMeshMessage(final Map<String, String> content, String topic) {
return EventMeshMessage.builder()
.content(JsonUtils.toJSONString(content))
.topic(ExampleConstants.EVENTMESH_GRPC_BROADCAT_TEST_TOPIC)
.topic(topic)
.uniqueId(RandomStringUtils.generateNum(30))
.bizSeqNo(RandomStringUtils.generateNum(30))
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static void main(String[] args) throws Exception {

final List<CloudEvent> cloudEventList = new ArrayList<>();
for (int i = 0; i < 5; i++) {
cloudEventList.add(buildCloudEvent(content));
cloudEventList.add(buildCloudEvent(content,
ExampleConstants.EVENTMESH_GRPC_BROADCAT_TEST_TOPIC));
}
eventMeshGrpcProducer.publish(cloudEventList);
ThreadUtils.sleep(10, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public static void main(String[] args) throws Exception {
content.put("content", "testAsyncMessage");

for (int i = 0; i < MESSAGE_SIZE; i++) {
eventMeshGrpcProducer.publish(buildCloudEvent(content));
eventMeshGrpcProducer.publish(buildCloudEvent(content,
ExampleConstants.EVENTMESH_GRPC_ASYNC_TEST_TOPIC));
ThreadUtils.sleep(1, TimeUnit.SECONDS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static void main(String[] args) throws Exception {
content.put("content", "testRequestReplyMessage");

for (int i = 0; i < MESSAGE_SIZE; i++) {
eventMeshGrpcProducer.requestReply(buildCloudEvent(content), EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
eventMeshGrpcProducer.requestReply(buildCloudEvent(content,
ExampleConstants.EVENTMESH_GRPC_RR_TEST_TOPIC), EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
ThreadUtils.sleep(1, TimeUnit.SECONDS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static void main(String[] args) throws Exception {
content.put("content", "testAsyncMessage");

for (int i = 0; i < MESSAGE_SIZE; i++) {
eventMeshGrpcProducer.publish(buildEventMeshMessage(content));
eventMeshGrpcProducer.publish(buildEventMeshMessage(content,
ExampleConstants.EVENTMESH_GRPC_BROADCAT_TEST_TOPIC));
ThreadUtils.sleep(1, TimeUnit.SECONDS);
}
ThreadUtils.sleep(30, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static void main(String[] args) throws Exception {
content.put("content", "testAsyncMessage");

for (int i = 0; i < MESSAGE_SIZE; i++) {
buildEventMeshMessage(content);
eventMeshGrpcProducer.publish(buildEventMeshMessage(content,
ExampleConstants.EVENTMESH_GRPC_ASYNC_TEST_TOPIC));
ThreadUtils.sleep(1, TimeUnit.SECONDS);
}
ThreadUtils.sleep(30, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static void main(String[] args) throws Exception {

List<EventMeshMessage> messageList = new ArrayList<>();
for (int i = 0; i < 5; i++) {
messageList.add(buildEventMeshMessage(content));
messageList.add(buildEventMeshMessage(content,
ExampleConstants.EVENTMESH_GRPC_BROADCAT_TEST_TOPIC));
}

eventMeshGrpcProducer.publish(messageList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static void main(String[] args) throws Exception {
content.put("content", "testRequestReplyMessage");

for (int i = 0; i < MESSAGE_SIZE; i++) {
eventMeshGrpcProducer.requestReply(buildEventMeshMessage(content),
eventMeshGrpcProducer.requestReply(buildEventMeshMessage(content,
ExampleConstants.EVENTMESH_GRPC_RR_TEST_TOPIC),
EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
ThreadUtils.sleep(1, TimeUnit.SECONDS);
}
Expand Down