You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by wa...@apache.org on 2022/09/19 14:58:52 UTC
[incubator-eventmesh] branch eventmesh-server-go updated: add protocol plugin api
This is an automated email from the ASF dual-hosted git repository.
walleliu pushed a commit to branch eventmesh-server-go
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/eventmesh-server-go by this push:
new cd733a72 add protocol plugin api
new e9894dd9 Merge pull request #1338 from walleliu1016/eventmesh-server-go-runtime
cd733a72 is described below
commit cd733a72b722388dcc58fa8b6875e2033f468129
Author: walleliu1016 <li...@163.com>
AuthorDate: Mon Sep 19 22:56:53 2022 +0800
add protocol plugin api
---
eventmesh-server-go/plugin/protocol/protocol.go | 36 +++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/eventmesh-server-go/plugin/protocol/protocol.go b/eventmesh-server-go/plugin/protocol/protocol.go
new file mode 100644
index 00000000..64023d13
--- /dev/null
+++ b/eventmesh-server-go/plugin/protocol/protocol.go
@@ -0,0 +1,36 @@
+// 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 protocol
+
+import (
+ cloudv2 "github.com/cloudevents/sdk-go/v2"
+)
+
+// Adapter protocol adapter
+// transfer the message with given protocol and events message
+type Adapter interface {
+ // ToCloudEvent transform protocol to CloudEvent
+ ToCloudEvent(interface{}) (*cloudv2.Event, error)
+
+ //ToCloudEvents transform protocol to CloudEvent list.
+ ToCloudEvents(interface{}) ([]*cloudv2.Event, error)
+
+ //FromCloudEvent transfor CloudEvent to target protocol.
+ FromCloudEvent(event *cloudv2.Event) (interface{}, error)
+
+ // ProtocolType protocol type, protocol type should not be null
+ ProtocolType() string
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org