You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/10/15 06:17:55 UTC

[incubator-eventmesh] branch protocol-amqp updated: realization exchange service interface

This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch protocol-amqp
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/protocol-amqp by this push:
     new ea7ec197  realization exchange service interface
     new 2b6338fb Merge pull request #1595 from wangshaojie4039/protocol-amqp
ea7ec197 is described below

commit ea7ec1979337916eb4b5a235b20b47213fff8e10
Author: wangshaojie <wa...@cmss.chinamobile.com>
AuthorDate: Sat Oct 15 14:15:19 2022 +0800

     realization exchange service interface
---
 .../protocol/amqp/exception/AmqpException.java     | 28 +++++++++
 .../protocol/amqp/service/ExchangeService.java     | 67 ++++++++++++++++++++++
 2 files changed, 95 insertions(+)

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/amqp/exception/AmqpException.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/amqp/exception/AmqpException.java
new file mode 100644
index 00000000..b5cc7ec1
--- /dev/null
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/amqp/exception/AmqpException.java
@@ -0,0 +1,28 @@
+package org.apache.eventmesh.runtime.core.protocol.amqp.exception;
+
+public class AmqpException extends Exception {
+
+    protected int errorCode;
+
+    public AmqpException() {
+    }
+
+    public AmqpException(int errorCode, String message, Throwable cause) {
+        super(message, cause);
+        this.errorCode = errorCode;
+    }
+
+    public AmqpException(int errorCode, String message) {
+        super(message);
+        this.errorCode = errorCode;
+    }
+
+    public AmqpException(String message, Throwable cause, int errorCode) {
+        super(message, cause);
+        this.errorCode = errorCode;
+    }
+
+    public int getErrorCode() {
+        return errorCode;
+    }
+}
diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/amqp/service/ExchangeService.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/amqp/service/ExchangeService.java
new file mode 100644
index 00000000..678a89f8
--- /dev/null
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/amqp/service/ExchangeService.java
@@ -0,0 +1,67 @@
+/*
+ * 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.runtime.core.protocol.amqp.service;
+
+import org.apache.eventmesh.runtime.core.protocol.amqp.exception.AmqpException;
+import org.apache.eventmesh.runtime.core.protocol.amqp.metadata.model.BindingInfo;
+import org.apache.eventmesh.runtime.core.protocol.amqp.metadata.model.ExchangeInfo;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * provide services to use ExchangeContainer
+ */
+public interface ExchangeService {
+
+    /**
+     * Declare a exchange.
+     *
+     * @param virtualHostName namespace
+     * @param exchange        the name of the exchange
+     * @param type            the exchange type
+     *                        are ignored; and sending nowait makes this method a no-op, so we default it to false.
+     * @param durable         true if we are declaring a durable exchange (the exchange will survive a server restart)
+     * @param autoDelete      true if the server should delete the exchange when it is no longer in use
+     * @param internal        true if the exchange is internal, i.e. can't be directly published to by a client
+     * @param arguments       other properties (construction arguments) for the exchange
+     * @return completableFuture of process result
+     */
+    void exchangeDeclare(String virtualHostName, String exchange, String type, boolean durable, boolean autoDelete, boolean internal,
+                         Map<String, Object> arguments) throws AmqpException;
+
+    /**
+     * Delete a exchange.
+     *
+     * @param virtualHostName namespace
+     * @param exchange        the name of the exchange
+     * @param ifUnused        true to indicate that the exchange is only to be deleted if it is unused
+     * @return completableFuture of process result
+     */
+    void exchangeDelete(String virtualHostName, String exchange, boolean ifUnused) throws AmqpException;
+
+
+    Set<BindingInfo> getBindings(String virtualHostName, String exchange) throws Exception;
+
+    ExchangeInfo getExchange(String virtualHostName, String exchange);
+
+    boolean checkExchangeExist(String virtualHostName, String exchange);
+
+    Set<String> getExchangeList(String virtualHostName) throws Exception;
+
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org