forked from apache/eventmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add EventMeshTCPClient, this client wrap the sub/sub client (apache#611)
- Loading branch information
1 parent
e6f254b
commit dae9632
Showing
30 changed files
with
765 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/EventMeshTCPClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.client.tcp; | ||
|
||
import org.apache.eventmesh.client.tcp.common.AsyncRRCallback; | ||
import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook; | ||
import org.apache.eventmesh.common.exception.EventMeshException; | ||
import org.apache.eventmesh.common.protocol.SubscriptionMode; | ||
import org.apache.eventmesh.common.protocol.SubscriptionType; | ||
import org.apache.eventmesh.common.protocol.tcp.Package; | ||
|
||
/** | ||
* EventMesh TCP client, used to sub/pub message by tcp. | ||
* You can use {@link org.apache.eventmesh.client.tcp.impl.EventMeshTCPClientFactory} to create a target client. | ||
* | ||
* @param <ProtocolMessage> | ||
*/ | ||
public interface EventMeshTCPClient<ProtocolMessage> extends AutoCloseable { | ||
|
||
void init() throws EventMeshException; | ||
|
||
Package rr(ProtocolMessage msg, long timeout) throws EventMeshException; | ||
|
||
void asyncRR(ProtocolMessage msg, AsyncRRCallback callback, long timeout) throws EventMeshException; | ||
|
||
Package publish(ProtocolMessage msg, long timeout) throws EventMeshException; | ||
|
||
void broadcast(ProtocolMessage msg, long timeout) throws EventMeshException; | ||
|
||
void heartbeat() throws EventMeshException; | ||
|
||
void listen() throws EventMeshException; | ||
|
||
void subscribe(String topic, SubscriptionMode subscriptionMode, SubscriptionType subscriptionType) | ||
throws EventMeshException; | ||
|
||
void unsubscribe() throws EventMeshException; | ||
|
||
void registerPubBusiHandler(ReceiveMsgHook<ProtocolMessage> handler) throws EventMeshException; | ||
|
||
void registerSubBusiHandler(ReceiveMsgHook<ProtocolMessage> handler) throws EventMeshException; | ||
|
||
void close() throws EventMeshException; | ||
|
||
EventMeshTCPPubClient<ProtocolMessage> getPubClient(); | ||
|
||
EventMeshTCPSubClient<ProtocolMessage> getSubClient(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...sdk-java/src/main/java/org/apache/eventmesh/client/tcp/conf/EventMeshTCPClientConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.client.tcp.conf; | ||
|
||
import org.apache.eventmesh.common.protocol.tcp.UserAgent; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class EventMeshTCPClientConfig { | ||
private String host; | ||
private int port; | ||
private UserAgent userAgent; | ||
} |
Oops, something went wrong.