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.
[ISSUE apache#4390] Realize the SPI extension loading of RabbitMQ adm…
…in-api (apache#4395) * config: rabbitmq spi without webhook, RESTORE BEFORE MERGE * config: add extensionType in META-INF * fix: resolve extension not found error when startup * feat: add rabbitmq management config * feat: provide limited admin func * Revert "config: rabbitmq spi without webhook, RESTORE BEFORE MERGE" This reverts commit a835cbf. * doc: add PR link to README
- Loading branch information
Showing
6 changed files
with
219 additions
and
9 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/README.md
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,26 @@ | ||
## Dashboard | ||
|
||
To enable eventmesh-dashboard admin UI for RabbitMQ, you need to add plugin rabbitmq_management. | ||
|
||
```bash | ||
rabbitmq-plugins enable rabbitmq_management | ||
``` | ||
|
||
## RabbitMQ Management | ||
|
||
The RabbitMQ management UI can be accessed using a Web browser at `http://{node-hostname}:15672/`. | ||
|
||
Users must be [granted permissions](https://www.rabbitmq.com/management.html#permissions) for management UI access. | ||
|
||
The following example creates a user with complete access to the management UI/HTTP API (as in, all virtual hosts and management features): | ||
|
||
```bash | ||
# create a user | ||
rabbitmqctl add_user full_access s3crEt | ||
# tag the user with "administrator" for full management UI and HTTP API access | ||
rabbitmqctl set_user_tags full_access administrator | ||
``` | ||
|
||
eventmesh-dashboard does not support authenticating with OAuth 2 currently. If you are using OAuth 2 to authenticate, you should keep `management.disable_basic_auth` configuration at default value `false` to support HTTP basic authentication. | ||
|
||
> More information for developers to provide admin functions: https://github.com/apache/eventmesh/pull/4395 |
72 changes: 72 additions & 0 deletions
72
...age-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/admin/RabbitMQAdmin.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,72 @@ | ||
/* | ||
* 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.storage.rabbitmq.admin; | ||
|
||
import org.apache.eventmesh.api.admin.AbstractAdmin; | ||
import org.apache.eventmesh.api.admin.TopicProperties; | ||
import org.apache.eventmesh.storage.rabbitmq.config.ConfigurationHolder; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
import io.cloudevents.CloudEvent; | ||
|
||
public class RabbitMQAdmin extends AbstractAdmin { | ||
|
||
private ConfigurationHolder configurationHolder; | ||
|
||
private String mgmtHost; | ||
|
||
private int mgmtPort; | ||
|
||
private String mgmtProtocol; | ||
|
||
public RabbitMQAdmin() { | ||
super(new AtomicBoolean(false)); | ||
} | ||
|
||
public void init() throws Exception { | ||
this.mgmtHost = configurationHolder.getHost(); | ||
this.mgmtPort = configurationHolder.getMgmtPort(); | ||
this.mgmtProtocol = configurationHolder.getMgmtProtocol(); | ||
} | ||
|
||
@Override | ||
public List<TopicProperties> getTopic() { | ||
// Utilizing the RabbitMQ Management HTTP API is a favorable approach to list queues and historical message counts. | ||
// To display topics, it would be necessary to retrieve the topic name from each message and use it to declare a corresponding queue. | ||
return new ArrayList<>(); | ||
} | ||
|
||
@Override | ||
public void createTopic(String topicName) { | ||
} | ||
|
||
@Override | ||
public void deleteTopic(String topicName) { | ||
} | ||
|
||
@Override | ||
public void publish(CloudEvent cloudEvent) throws Exception { | ||
} | ||
|
||
@Override | ||
public void shutdown() { | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
...bitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/admin/RabbitMQAdminAdaptor.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,85 @@ | ||
/* | ||
* 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.storage.rabbitmq.admin; | ||
|
||
import org.apache.eventmesh.api.admin.Admin; | ||
import org.apache.eventmesh.api.admin.TopicProperties; | ||
|
||
import java.util.List; | ||
import java.util.Properties; | ||
|
||
import io.cloudevents.CloudEvent; | ||
|
||
public class RabbitMQAdminAdaptor implements Admin { | ||
|
||
private final RabbitMQAdmin admin; | ||
|
||
public RabbitMQAdminAdaptor() { | ||
admin = new RabbitMQAdmin(); | ||
} | ||
|
||
@Override | ||
public boolean isStarted() { | ||
return admin.isStarted(); | ||
} | ||
|
||
@Override | ||
public boolean isClosed() { | ||
return admin.isClosed(); | ||
} | ||
|
||
@Override | ||
public void start() { | ||
admin.start(); | ||
} | ||
|
||
@Override | ||
public void shutdown() { | ||
admin.shutdown(); | ||
} | ||
|
||
@Override | ||
public void init(Properties properties) throws Exception { | ||
admin.init(properties); | ||
} | ||
|
||
@Override | ||
public List<TopicProperties> getTopic() throws Exception { | ||
return admin.getTopic(); | ||
} | ||
|
||
@Override | ||
public void createTopic(String topicName) { | ||
admin.createTopic(topicName); | ||
} | ||
|
||
@Override | ||
public void deleteTopic(String topicName) { | ||
admin.deleteTopic(topicName); | ||
} | ||
|
||
@Override | ||
public List<CloudEvent> getEvent(String topicName, int offset, int length) throws Exception { | ||
return admin.getEvent(topicName, offset, length); | ||
} | ||
|
||
@Override | ||
public void publish(CloudEvent cloudEvent) throws Exception { | ||
admin.publish(cloudEvent); | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
...orage-rabbitmq/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
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,16 @@ | ||
# 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. | ||
|
||
rabbitmq=org.apache.eventmesh.storage.rabbitmq.admin.RabbitMQAdminAdaptor |
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