-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,028 additions
and
6 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
74 changes: 74 additions & 0 deletions
74
...ain/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRuntimeConfig.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,74 @@ | ||
/* | ||
* 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.dashboard.core.function.SDK.config; | ||
|
||
import org.apache.eventmesh.common.protocol.tcp.UserAgent; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class CreateRuntimeConfig implements CreateSDKConfig { | ||
|
||
// 127.0.0.1:10105;127.0.0.2:10105 | ||
private String runtimeServerAddress; | ||
|
||
// protocol example:HTTP,TCP,GRPC | ||
private String protocol; | ||
// for tcp:cloudevents,eventmeshmessage,openmessage | ||
private String protocolName; | ||
|
||
// producer or consumer | ||
private String clientType; | ||
|
||
// topic | ||
private String topic; | ||
|
||
// grpc subscriptionItem | ||
// private SubscriptionMode mode; | ||
// private SubscriptionType type; | ||
|
||
// config | ||
private String env; | ||
private String idc; | ||
private String ip; | ||
private String sys; | ||
private String pid; | ||
private String username; | ||
private String password; | ||
|
||
// producer | ||
private String producerGroup; | ||
|
||
// consumer | ||
private String consumerGroup; | ||
private String subUrl; | ||
|
||
// Agent | ||
private UserAgent userAgent; | ||
|
||
@Override | ||
public String getUniqueKey() { | ||
return runtimeServerAddress; | ||
} | ||
} |
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
54 changes: 54 additions & 0 deletions
54
...ache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperation.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,54 @@ | ||
/* | ||
* 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.dashboard.core.function.SDK.operation; | ||
|
||
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshGrpcConsumerConfig; | ||
|
||
import org.apache.eventmesh.client.grpc.config.EventMeshGrpcClientConfig; | ||
import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer; | ||
import org.apache.eventmesh.common.exception.EventMeshException; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; | ||
|
||
import java.util.AbstractMap.SimpleEntry; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class RuntimeGrpcConsumerSDKOperation extends AbstractSDKOperation<EventMeshGrpcConsumer> { | ||
|
||
@Override | ||
public SimpleEntry<String, EventMeshGrpcConsumer> createClient(CreateSDKConfig clientConfig) { | ||
final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig; | ||
final EventMeshGrpcClientConfig grpcClientConfig = buildEventMeshGrpcConsumerConfig(runtimeConfig); | ||
EventMeshGrpcConsumer grpcConsumer = null; | ||
try { | ||
grpcConsumer = new EventMeshGrpcConsumer(grpcClientConfig); | ||
grpcConsumer.init(); | ||
} catch (EventMeshException e) { | ||
log.error("create runtime grpc Consumer client failed", e); | ||
} | ||
return new SimpleEntry<>(clientConfig.getUniqueKey(), grpcConsumer); | ||
} | ||
|
||
@Override | ||
public void close(Object client) { | ||
castClient(client).close(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...ache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperation.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,53 @@ | ||
/* | ||
* 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.dashboard.core.function.SDK.operation; | ||
|
||
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshGrpcProducerConfig; | ||
|
||
import org.apache.eventmesh.client.grpc.config.EventMeshGrpcClientConfig; | ||
import org.apache.eventmesh.client.grpc.producer.EventMeshGrpcProducer; | ||
import org.apache.eventmesh.common.exception.EventMeshException; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; | ||
|
||
import java.util.AbstractMap.SimpleEntry; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class RuntimeGrpcProducerSDKOperation extends AbstractSDKOperation<EventMeshGrpcProducer> { | ||
|
||
@Override | ||
public SimpleEntry<String, EventMeshGrpcProducer> createClient(CreateSDKConfig clientConfig) { | ||
final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig; | ||
final EventMeshGrpcClientConfig grpcClientConfig = buildEventMeshGrpcProducerConfig(runtimeConfig); | ||
EventMeshGrpcProducer grpcProducer = null; | ||
try { | ||
grpcProducer = new EventMeshGrpcProducer(grpcClientConfig); | ||
} catch (EventMeshException e) { | ||
log.error("create runtime grpc Producer client failed", e); | ||
} | ||
return new SimpleEntry<>(clientConfig.getUniqueKey(), grpcProducer); | ||
} | ||
|
||
@Override | ||
public void close(Object client) { | ||
castClient(client).close(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...ache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperation.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,53 @@ | ||
/* | ||
* 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.dashboard.core.function.SDK.operation; | ||
|
||
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshHttpConsumerConfig; | ||
|
||
import org.apache.eventmesh.client.http.conf.EventMeshHttpClientConfig; | ||
import org.apache.eventmesh.client.http.consumer.EventMeshHttpConsumer; | ||
import org.apache.eventmesh.common.exception.EventMeshException; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; | ||
|
||
import java.util.AbstractMap.SimpleEntry; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class RuntimeHttpConsumerSDKOperation extends AbstractSDKOperation<EventMeshHttpConsumer> { | ||
|
||
@Override | ||
public SimpleEntry<String, EventMeshHttpConsumer> createClient(CreateSDKConfig clientConfig) { | ||
final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig; | ||
final EventMeshHttpClientConfig httpClientConfig = buildEventMeshHttpConsumerConfig(runtimeConfig); | ||
EventMeshHttpConsumer httpConsumer = null; | ||
try { | ||
httpConsumer = new EventMeshHttpConsumer(httpClientConfig); | ||
} catch (EventMeshException e) { | ||
log.error("create runtime http Consumer client failed", e); | ||
} | ||
return new SimpleEntry<>(clientConfig.getUniqueKey(), httpConsumer); | ||
} | ||
|
||
@Override | ||
public void close(Object client) { | ||
castClient(client).close(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...ache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperation.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,53 @@ | ||
/* | ||
* 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.dashboard.core.function.SDK.operation; | ||
|
||
import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshHttpProducerConfig; | ||
|
||
import org.apache.eventmesh.client.http.conf.EventMeshHttpClientConfig; | ||
import org.apache.eventmesh.client.http.producer.EventMeshHttpProducer; | ||
import org.apache.eventmesh.common.exception.EventMeshException; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; | ||
import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; | ||
|
||
import java.util.AbstractMap.SimpleEntry; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class RuntimeHttpProducerSDKOperation extends AbstractSDKOperation<EventMeshHttpProducer> { | ||
|
||
@Override | ||
public SimpleEntry<String, EventMeshHttpProducer> createClient(CreateSDKConfig clientConfig) { | ||
final CreateRuntimeConfig runtimeConfig = (CreateRuntimeConfig) clientConfig; | ||
final EventMeshHttpClientConfig httpClientConfig = buildEventMeshHttpProducerConfig(runtimeConfig); | ||
EventMeshHttpProducer httpProducer = null; | ||
try { | ||
httpProducer = new EventMeshHttpProducer(httpClientConfig); | ||
} catch (EventMeshException e) { | ||
log.error("create runtime http Producer client failed", e); | ||
} | ||
return new SimpleEntry<>(clientConfig.getUniqueKey(), httpProducer); | ||
} | ||
|
||
@Override | ||
public void close(Object client) { | ||
castClient(client).close(); | ||
} | ||
} |
Oops, something went wrong.