From 46c566b279942585bfb1cd189ab91ad33fb4542d Mon Sep 17 00:00:00 2001 From: sodaRyCN <757083350@qq.com> Date: Wed, 29 May 2024 11:29:51 +0800 Subject: [PATCH] fix gradle dependecy and add runtime v2 --- .idea/icon.png | Bin 14821 -> 0 bytes build.gradle | 2 +- eventmesh-admin-server/build.gradle | 6 +- .../config/DingDingConnectServerConfig.java | 2 +- .../sink/config/DingDingSinkConfig.java | 30 - .../sink/config/SinkConnectorConfig.java | 36 - .../sink/connector/DingDingSinkConnector.java | 4 +- .../connector/DingDingSinkConnectorTest.java | 6 +- .../eventmesh-connector-file/build.gradle | 1 + .../file/config/FileServerConfig.java | 2 +- .../file/sink/config/FileSinkConfig.java | 35 - .../file/sink/config/SinkConnectorConfig.java | 28 - .../sink/connector/FileSinkConnector.java | 4 +- .../file/source/config/FileSourceConfig.java | 30 - .../source/config/SourceConnectorConfig.java | 28 - .../source/connector/FileSourceConnector.java | 16 +- .../http/config/HttpServerConfig.java | 2 +- .../http/source/config/HttpSourceConfig.java | 30 - .../source/config/SourceConnectorConfig.java | 32 - .../source/connector/HttpSourceConnector.java | 5 +- .../connector/HttpSourceConnectorTest.java | 5 +- .../connector/jdbc/config/JdbcConfig.java | 66 -- .../jdbc/config/JdbcServerConfig.java | 3 +- .../jdbc/connection/JdbcConnection.java | 2 +- .../connection/mysql/MysqlJdbcConnection.java | 2 +- .../AbstractGeneralDatabaseDialect.java | 2 +- .../jdbc/dialect/DatabaseDialectFactory.java | 2 +- .../dialect/mysql/MysqlDatabaseDialect.java | 2 +- .../mysql/MysqlDatabaseDialectFactory.java | 2 +- .../jdbc/sink/JdbcSinkConnector.java | 6 +- .../jdbc/sink/config/JdbcSinkConfig.java | 35 - .../jdbc/sink/config/SinkConnectorConfig.java | 43 - .../sink/handle/DefaultSinkRecordHandler.java | 2 +- .../jdbc/source/JdbcSourceConnector.java | 6 +- .../jdbc/source/SourceJdbcTaskManager.java | 6 +- .../jdbc/source/config/JdbcSourceConfig.java | 30 - .../jdbc/source/config/MysqlConfig.java | 54 -- .../source/config/SourceConnectorConfig.java | 78 -- .../source/dialect/cdc/AbstractCdcEngine.java | 2 +- .../source/dialect/cdc/CdcEngineFactory.java | 2 +- .../dialect/cdc/mysql/MysqlCdcEngine.java | 3 +- .../cdc/mysql/MysqlCdcEngineFactory.java | 2 +- .../snapshot/SnapshotEngineFactory.java | 2 +- .../eventmesh-connector-kafka/build.gradle | 1 + .../kafka/config/KafkaServerConfig.java | 2 +- .../kafka/sink/config/KafkaSinkConfig.java | 29 - .../sink/config/SinkConnectorConfig.java | 39 - .../sink/connector/KafkaSinkConnector.java | 4 +- .../source/config/KafkaSourceConfig.java | 28 - .../source/config/SourceConnectorConfig.java | 36 - .../connector/KafkaSourceConnector.java | 28 +- .../knative/config/KnativeServerConfig.java | 2 +- .../sink/config/KnativeSinkConfig.java | 31 - .../sink/config/SinkConnectorConfig.java | 31 - .../sink/connector/KnativeSinkConnector.java | 4 +- .../source/config/KnativeSourceConfig.java | 31 - .../source/config/SourceConnectorConfig.java | 31 - .../connector/KnativeSourceConnector.java | 4 +- .../lark/config/LarkConnectServerConfig.java | 2 +- .../connector/lark/sink/ImServiceHandler.java | 2 +- .../lark/sink/config/LarkSinkConfig.java | 31 - .../lark/sink/config/SinkConnectorConfig.java | 81 -- .../sink/connector/LarkSinkConnector.java | 9 +- .../lark/sink/ImServiceHandlerTest.java | 8 +- .../lark/sink/LarkSinkConnectorTest.java | 6 +- .../mongodb/config/MongodbServerConfig.java | 4 +- .../client/MongodbReplicaSetSinkClient.java | 2 +- .../client/MongodbStandaloneSinkClient.java | 2 +- .../sink/config/MongodbSinkConfig.java | 28 - .../sink/config/SinkConnectorConfig.java | 34 - .../sink/connector/MongodbSinkConnector.java | 4 +- .../client/MongodbReplicaSetSourceClient.java | 2 +- .../client/MongodbStandaloneSourceClient.java | 2 +- .../source/config/MongodbSourceConfig.java | 28 - .../source/config/SourceConnectorConfig.java | 35 - .../connector/MongodbSourceConnector.java | 4 +- .../config/OpenFunctionServerConfig.java | 2 +- .../sink/config/OpenFunctionSinkConfig.java | 31 - .../sink/config/SinkConnectorConfig.java | 28 - .../connector/OpenFunctionSinkConnector.java | 4 +- .../config/OpenFunctionSourceConfig.java | 31 - .../source/config/SourceConnectorConfig.java | 27 - .../OpenFunctionSourceConnector.java | 4 +- .../OpenFunctionSinkConnectorTest.java | 6 +- .../OpenFunctionSourceConnectorTest.java | 6 +- .../pravega/config/PravegaServerConfig.java | 2 +- .../sink/config/PravegaSinkConfig.java | 31 - .../sink/config/SinkConnectorConfig.java | 46 - .../sink/connector/PravegaSinkConnector.java | 4 +- .../source/config/PravegaSourceConfig.java | 31 - .../source/config/SourceConnectorConfig.java | 47 - .../connector/PravegaSourceConnector.java | 4 +- .../build.gradle | 1 + .../config/PrometheusServerConfig.java | 2 +- .../source/config/PrometheusSourceConfig.java | 30 - .../source/config/SourceConnectorConfig.java | 40 - .../connector/PrometheusSourceConnector.java | 8 +- .../eventmesh-connector-pulsar/build.gradle | 1 + .../pulsar/config/PulsarServerConfig.java | 2 +- .../pulsar/sink/config/PulsarSinkConfig.java | 29 - .../sink/config/SinkConnectorConfig.java | 30 - .../sink/connector/PulsarSinkConnector.java | 4 +- .../source/config/PulsarSourceConfig.java | 28 - .../source/config/SourceConnectorConfig.java | 30 - .../connector/PulsarSourceConnector.java | 16 +- .../rabbitmq/config/RabbitMQServerConfig.java | 6 +- .../sink/config/RabbitMQSinkConfig.java | 31 - .../sink/config/SinkConnectorConfig.java | 48 - .../sink/connector/RabbitMQSinkConnector.java | 8 +- .../source/config/RabbitMQSourceConfig.java | 30 - .../source/config/SourceConnectorConfig.java | 48 - .../connector/RabbitMQSourceConnector.java | 10 +- .../eventmesh-connector-redis/build.gradle | 1 + .../redis/config/RedisServerConfig.java | 2 +- .../redis/sink/config/RedisSinkConfig.java | 29 - .../sink/config/SinkConnectorConfig.java | 30 - .../sink/connector/RedisSinkConnector.java | 4 +- .../source/config/RedisSourceConfig.java | 29 - .../source/config/SourceConnectorConfig.java | 31 - .../connector/RedisSourceConnector.java | 4 +- .../connector/RedisSinkConnectorTest.java | 6 +- .../connector/RedisSourceConnectorTest.java | 6 +- .../rocketmq/config/RocketMQServerConfig.java | 2 +- .../sink/config/RocketMQSinkConfig.java | 31 - .../sink/config/SinkConnectorConfig.java | 30 - .../sink/connector/RocketMQSinkConnector.java | 4 +- .../source/config/RocketMQSourceConfig.java | 30 - .../source/config/SourceConnectorConfig.java | 32 - .../connector/RocketMQSourceConnector.java | 56 +- .../connector/RocketMQSinkConnectorTest.java | 6 +- .../eventmesh-connector-s3/build.gradle | 1 + .../connector/s3/config/S3ServerConfig.java | 2 +- .../s3/source/config/S3SourceConfig.java | 28 - .../source/config/SourceConnectorConfig.java | 53 -- .../source/connector/S3SourceConnector.java | 32 +- .../config/SlackConnectServerConfig.java | 2 +- .../sink/config/SinkConnectorConfig.java | 30 - .../slack/sink/config/SlackSinkConfig.java | 30 - .../sink/connector/SlackSinkConnector.java | 4 +- .../connector/SlackSinkConnectorTest.java | 6 +- .../config/SpringConnectServerConfig.java | 2 +- .../spring/sink/config/SpringSinkConfig.java | 31 - .../sink/connector/SinkConnectorConfig.java | 27 - .../sink/connector/SpringSinkConnector.java | 4 +- .../source/config/SpringSourceConfig.java | 31 - .../connector/SourceConnectorConfig.java | 27 - .../connector/SpringSourceConnector.java | 8 +- .../connector/SpringSinkConnectorTest.java | 6 +- .../connector/SpringSourceConnectorTest.java | 2 +- .../config/WeChatConnectServerConfig.java | 2 +- .../sink/config/SinkConnectorConfig.java | 30 - .../wechat/sink/config/WeChatSinkConfig.java | 30 - .../sink/connector/WeChatSinkConnector.java | 4 +- .../connector/WeChatSinkConnectorTest.java | 6 +- .../config/WeComConnectServerConfig.java | 2 +- .../sink/config/SinkConnectorConfig.java | 29 - .../wecom/sink/config/WeComSinkConfig.java | 30 - .../sink/connector/WeComSinkConnector.java | 4 +- .../connector/WeComSinkConnectorTest.java | 34 +- .../eventmesh/openconnect/Application.java | 6 +- .../eventmesh/openconnect/SinkWorker.java | 2 +- .../eventmesh/openconnect/SourceWorker.java | 8 +- .../openconnect/api/config/Config.java | 21 - .../openconnect/api/config/Constants.java | 33 - .../openconnect/api/config/PubSubConfig.java | 41 - .../openconnect/api/config/SinkConfig.java | 29 - .../openconnect/api/config/SourceConfig.java | 33 - .../openconnect/api/connector/Connector.java | 2 +- .../api/connector/SinkConnector.java | 2 +- .../api/connector/SinkConnectorContext.java | 2 +- .../api/connector/SourceConnector.java | 2 +- .../api/connector/SourceConnectorContext.java | 2 +- .../openconnect/util/ConfigUtil.java | 8 +- .../build.gradle | 1 + .../api/config/OffsetStorageConfig.java | 32 - .../offsetmgmt/api/data/ConnectRecord.java | 8 + .../offsetmgmt/api/data/RecordOffset.java | 61 -- .../api/data/RecordOffsetManagement.java | 17 +- .../offsetmgmt/api/data/RecordPartition.java | 62 -- .../offsetmgmt/api/data/RecordPosition.java | 58 -- .../api/storage/ConnectorRecordPartition.java | 67 -- .../DefaultOffsetManagementServiceImpl.java | 15 +- .../api/storage/OffsetManagementService.java | 21 +- .../api/storage/OffsetStorageReader.java | 4 +- .../api/storage/OffsetStorageReaderImpl.java | 19 +- .../api/storage/OffsetStorageWriter.java | 4 +- .../api/storage/OffsetStorageWriterImpl.java | 20 +- .../offsetmgmt/nacos/NacosConfigService.java | 55 +- eventmesh-runtime-v2/build.gradle | 7 + .../runtime/RuntimeInstanceConfig.java | 9 +- .../runtime/boot/RuntimeInstance.java | 161 ++-- .../runtime/boot/RuntimeInstanceStarter.java | 20 +- .../runtime/connector/ConnectorRuntime.java | 359 +++++++- .../connector/ConnectorRuntimeConfig.java | 9 +- .../runtime/rpc/AdminBiStreamServiceGrpc.java | 260 ------ .../runtime/rpc/AdminServiceGrpc.java | 276 ------ .../runtime/rpc/EventMeshAdminService.java | 77 -- .../eventmesh/runtime/rpc/Metadata.java | 841 ------------------ .../runtime/rpc/MetadataOrBuilder.java | 53 -- .../apache/eventmesh/runtime/rpc/Payload.java | 793 ----------------- .../runtime/rpc/PayloadOrBuilder.java | 37 - .../main/proto/event_mesh_admin_service.proto | 25 - .../src/main/resources/connector.yaml | 18 + .../src/main/resources/runtime.yaml | 2 + settings.gradle | 2 + 205 files changed, 839 insertions(+), 5522 deletions(-) delete mode 100644 .idea/icon.png delete mode 100644 eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/DingDingSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/FileSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/FileSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/HttpSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/JdbcSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/JdbcSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/MysqlConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/KafkaSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/KafkaSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/KnativeSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/KnativeSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/LarkSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/MongodbSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/MongodbSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/OpenFunctionSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/OpenFunctionSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/PravegaSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/PravegaSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/PrometheusSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/PulsarSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/PulsarSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/RabbitMQSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/RabbitMQSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/RedisSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/RedisSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/RocketMQSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/RocketMQSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/S3SourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SlackSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/config/SpringSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/config/SpringSourceConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SourceConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/WeChatSinkConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/SinkConnectorConfig.java delete mode 100644 eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/WeComSinkConfig.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Config.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Constants.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/PubSubConfig.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SinkConfig.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SourceConfig.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/config/OffsetStorageConfig.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffset.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPartition.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPosition.java delete mode 100644 eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/ConnectorRecordPartition.java delete mode 100644 eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/AdminBiStreamServiceGrpc.java delete mode 100644 eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/AdminServiceGrpc.java delete mode 100644 eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/EventMeshAdminService.java delete mode 100644 eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/Metadata.java delete mode 100644 eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/MetadataOrBuilder.java delete mode 100644 eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/Payload.java delete mode 100644 eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/PayloadOrBuilder.java delete mode 100644 eventmesh-runtime-v2/src/main/proto/event_mesh_admin_service.proto create mode 100644 eventmesh-runtime-v2/src/main/resources/connector.yaml diff --git a/.idea/icon.png b/.idea/icon.png deleted file mode 100644 index 59aa06dac91d655b8f5e61607b3f4fb3fb7218af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14821 zcmd73_ghoV7dd!5Tth`Nbg8d zssWUy6h%O!+~E7U_xaxExqrarhn$&n_Uu_}@3m(pg;--lEh=&r@+()aQ0Zvjx_#ve z8QGO9#0tdM2zN}rKfJs!8S9&BYI*95W2$9>8wKpkjOsrMJ5<80UJ@E`qR<-z8xr5! zh9*}+l-uevHHh4wu`xf#K(_fVt}(+x))NsDzG-J2UL9 ziXRsxIfhJ$B5yr;^mNmq0NPK?HTIE~;E(Y4qu}x5#oZ(E_5Nd6*sn*bEz!F_lJ?k- zRQC@LWoJU%tNvCY&b-Fgx7H65misbnLY{_O1of@`QE%Vnk2|wS4qFa=!HI$aMAi3Xe0XOl_teNY~*f_VK7GlSE(a;yt%s1(TTf#-CAm-=BDB>gb(fV zZS5h)pU%A;&HKkeVN5M)2ooBg>d+?|``h$&Q39y@P|O4A(npq`t+c7?9gfKb({)^* zt5L}Ua0nDHS7t9I1_2W{qbz5>1DAQ?#^GfJenw# z&F29^;2y-*T_+J;q0v!>>#B23Fh66P#OpF+c9=6qYuH~+G^`f9-!KdpE!y6C$EAE* z-h#c>ib(KH(e}(QCJ`WF+G|{vR_>1E$ucF=)5vRVDP~w2U|8KMWn}uMygJbjU8z!+ z)D!A=hq7{=oRm-PRG#MMRgqHJMbW;tfD-TFU4l~$A}BYl&9UefxAq3%H~k0}?8>fO z5;nBrW9Nj5O5#M+v@2Xr(%n45O7wQF6s)?Vlhb`pg;W)sUz0ou? zWGd59*`ZG7UzygF&6J^qzd9!Qkz*l|)O14+3tc_JjGpJ*8MK&4f24i=Q->P_1lD!-5+L zQC*@=EVgx>-B^vmY&(@rOxjxJt9CG%y29RJ&$R35^k2JHIrI|D$;GroRJ!M)24!VB z=Ib=ql|5rLJlDK-cc?42r0RtyFCuV~9;;e$u|jFf{3lo#inFtNwzx4ko;fiqWlx_L zu+N4t=Oe*1*AI)FF-zO#@Qw4!{U*Dw_Y2Kp_;{ zo)eo@h2pRAZG1R+rk*BAvI>5(E}p4HJ!p@XDrO4&^V7|A#Q0!PbybqdWY1*D*cDsb zaDd~KGy(an&fJ2XzOUUIv(zF-yB!$N;a%O*Q*qiK=^v= z%b3LeHojaBeT*97j?}|PMvL#tLZs)4QX=b(Ev5tRjSAb53jzhzZrbu*4=0NtT1*u1 zNm4x+hMNu}A9tt=iIWphs4$VBleNRsY2RvE#ku8kth34x`(U-$8l@hXCR!yzE^G0c$? zmS*ftjc)??#=KTHXpbqP^a(Suu~3vp87l4=O!TK|NP}5LA{}?&(WE4quh|*ZuP1_| zfY(h@FJ0%YJv}BXndhXy2pzr*nP1tlBCn(Lg%)$W^x@SQ5h={j?hv>kW9j3vh1;|n%; z!@QQ@OMHK5V;xnjzhV`&x2Z_Jme5qr*;H$Bcd#(|#hy;Y1wZ<+`hwTJNgcYIX==%K zO_CmpVfm>>MSwVy85KBHdNL?|kK~#L?vR)YA0K%~1L6Oo@V9{54JIaNLx~m&TZ%Ha zOopnURg+l^3JCoc!>cm6@RzTVPBN4^H}phMSn!m9u>0hjD7M@JQEAVIFfYwSAqQk4 zVe~-3JI}jLl{alQu8+Jz?*E>=Nw4+tm1uX0@w~16f{B0xT%Yv(XoSJg@x>|dH&sZT!j)o(UTGDQe@9dSNvcoaz(|&^pJYMPU04j^M!qDDj5oP8NhbV3GuOpHAxk&`b-jy2md~IgxiF~*W)DwhO49j!? z8(_RZ^BVbkdNlGe_{Zlzd7Xc-`W*C(SVxp3+s4p`p8M=%;8#pNvoRXg7+(>8GpfAS$F2m4`Q4)&aFF3~cCCiu779D`Yh8M1eA@HRdf)8LUwc+} zMo#q(p2o49amR!`rtBLtI@{9ew(ePCq0@hb?7Z&q3G<^f`Kg_-zjGAm5vU@vu}C#( z|0izl#AIxIriQM(?=IK);GC@$U$J=GJ@MH}rX)Y9O-g(HFDFY`ig|7{0f9RTt>!24 zrp;BfzLH_vJ}-AM56J2w1IQ&g1)o&HTvA>m_kw@;OkK6bLCzzy$jvutG{4^^l~IVU z94Co9AX_?{$8vnl+7Awg;n@xyh4n4`7+U1C$|As18;uvo2BkN9j->iqeQdYBaB1Lb zyx&ea)f)=f{3RS{`xS(>7H^9c?58>a!D-0f8V^$0)m(NqFE z_6j-cG${}-y__|9Nbco7Z06pN1rLzfeU#xOrVAGNtT|bP2?GvfaafWu3Oy^U-+G*M#-_ z*J~8tAN;z-s7e*)w%eTbfRCBZ3p?MDJNNh-!D!$7D|SP!M8KM)p;-4`dBHt3Dj7E} zm$q+oML$wD1p~MhNKME67)E6Ht>ty$$vt@0>xI)B28U~3-H(yUfVu0lyV|ZiE=oY1 z`okq;kj0y8Q2=&Qi#=^WBu_umPIB?FKu5aPyM=-`O>^C$n8c13;P|D{)#k( zpw=1TcGNuq**~FOtqzCT!)^^aRpc^ml+&<+WYHT6$G!T}xhW|+?UFXm9+@NchVR1j zQa!Pm8etzxNBpma3TG?vl?OQ?5U$}Yl`~cf+O~fmoN$uPxlPT@TAwZQclXU&vIq1% zy((kXGs`+6DDwP!kHD;DN(xb=s6Pk1j{5aL{tDcGKR)9|G+%?Uou#zdbkHK42P*X{ zWyM^K5LrLLZPt>7?q zE6T<|TOL8@C$sg(q|Q()A=lUWEgv`IiGBOM@IrCy47^I&F&7wJu!Ogb zhJSv4J=v2@26fGsqed<}Jc$dLp%7WL*d8*k*h5j0<)P zWsaq{Ipg9+QYlE+c7>*?))i0Z$D;)la7r& zB^p81ytMABA^7M@QOh@b z29B~7iJ%Djg5$oy*AchAF7@)mXvsC;>`)c6jrOxKJ{7R#G6Q*NUGJQkx^lqRBCY#S zDLy(kF!1XjBK)UN=qfGzR$?zoDr>`Gii`5APGF>PDXR0K(jEC#$P0k1pSu!SuTrDS zDxm^?-2Zw-)1f6+?|4>L9p{`H=;Tq!RhcH`kJpjMG0@P{`3<%vhRk^cLJ?)v;Kewej8jD=xt+i?Dq5f!u{jv)$I-c~i+hWSnC^lz1F z+bj8+|9HW9Y{pishM02omkBaotP*T~ot83b;IRj!Lh=AJ9}*R4o1(Y2?=~#s8o!c%D(;suJ`l97vHUVqtgc zXo&_=jN55nN#UP6{7A5>e-ocp9WD9V?S{h%8^Rj`ZHOt;kvRcVBpanbps$hcHG2od zVBTM4^0Jk0CSC@fwTrWG4`>h&o@CT7Q|%8e(MnUh1zO7J4Xn)FQ=^4~O7@H^l)Y9RCl~y3B7o_3D zFCC&;A_3peTPxu#BSttPD6*GSh8zq-zX@E0alwwotn4i#fRt)ki+>lX%L_4`4EdCH zOy8^tmgk5PtbRvkkT6sDSl1v68~`%@Ul+gsdd&_7@3~+xrATHd0^K#ca2;d1ZFkHn(r_}!;Stwy{+h1|3BW0EfWtfncSHc&_HN|&PggR z=~^)UcVYfNd&iuIJ7Ud=Jh8Y^ZDgm$?Jw+^S9c4UK53!ze(En}GS&kRo)WB)FLfEA?)y_G~>#u^I-WWGsV;way2jvRk`vw;_KSnTw*c=14us{)U_1o~{q z;1-t%Slv~YKobItWU>;5e@KLa^jcA&YD5TKF*%bDMv7m^0N%Qah5V}_IRu^z6R*8j z3B=QFFiAA3RLWcx1x{c2aEVsX@ahHv5SWA4#W64a-(Lsmxmq^IT0j*nuc2u~h2$=oK40_pc_6C{0kwXt@$M#| zQ(O=Tt3G%p@geal8Nq{7{iP?FOyIw;c-KCZRW^nIijZ%atpD=r-JJ6e%!2nl9S|W@ zP$-Bjl>k4ydWaV$M~;AaV~G(MU-vN5OK+N|QiM?=uQj_a;|<}<%8O|vgcQeZWr{h? z>m=yJyBX|-%>=mCkj*H9lWA|-6@nzx`xE)Z!Gt?jP`eqyFIhJ&ufgPkEdK|JU_x}s zv*v$DF2lxE2ZuwFUTc2s9bf^eXWL+!2<}o?c?o!|-J>W#%@gst+#z#BVq7AGxPGJC z8zKm_I))+R|E6_Q_LBMHeaq%|aAFw9XDE>u22yv`(f%JaiK>N5RlwwQx!5%02NN$j zOEfR&6R;DbG0itg{!y)ixBaJo@8iKmflM2sx&->RxY_dG;QxuXf>jxLdgH;<6xMbTLdk_o%q9|aN-&S+q%nG+ z1N!H{^Pgy_RWEZ%i1jUzOG*5T(efz?3?wW9rtZH2lgr)uS9SzX|0GHx7e@h^8Lz=d z|BImF|8Ni-kGcP!jtNS|&0%gh==3KNlw#nIl@=mU{UHXXF1>;V-?Zd`@VQUyb^p_o z(&-l@fu^IJ+a*f|i_37WA;sO7zl-w_L`vup;{`CjWMD{Uis~ya$YB%wpW-j;Lyr;h z57*DEoy*|aj3jVaf#?W9aXx5wYedq56h9*R*8e>kh!?YsidGV4Q&yy9mI2 zV018yX|Q^>_&)@1{}UTw(IjMQ@RFECSK>~aG$GYnNOnGg5D94)-Oii-FPB>%E|;&e zf96T_Tve2amwk`FUIHDyT-U=T{wv6<|EY-}3Pq-;1pEKG|Eq%dU-2sas>E~9MbiB$wW9oK@=vs^0VvX~Ef z|M9roTnH-u2aIp%ACLF{lh5Kt`!46@asmb_2MKE>0jlb&D=<(WdHkgsjt&1Sjejik zGYKqYiO~c2u>a`%s|KR~N8?8wPar2|O{lBr@*q4?{Sy=*aS8ml2E9W#Tq5i+F`OCP zB*w*IeAkCK8FABk?(OL#mq8;Tq^6s!0Cl1nc}mpN6-}s5B*_P?|EsKCSj9}c{6DE* zf|%6^v^fh!DK(*Ln@mCOP9FaVlE`hG+ReM^ro3Zs)QlkZT*9g|42zhhz=(PH{ z7Hf7~?4uRreG!oG$j9du8BBf5<6+b1#(gqGRzJNJx^Z zF~|$6$Qc}a`nN8zmgW3cEa7bqAQOcRm4Cs*lfenX)V&3taBS#6jW|=hu#2u+B)Ew@ zLTyE1w-JH-@r@fum*vNa&BL6j9UsRE6`}m@k+gfK=sd5#mQubo&TM;!-K7Tpc8UYz z11yXO-;9?}qH3&t_}w#Hyz|uMYx2Bn%q*;%kv@?D0|Qp*#Rv4;w5oHtto87UkI-|= zD#KIP8W^T&5OW#pfJDY6?18rjxy~k$$txfRT4Wnhf)CC365)xFW)4 zW0UmbeQD5c;je|!g#j!6md|2yax8fb3mffY?c+*!O+e9X`+u&HV|>&6rbNv%SV{G8 zILtv+g8_1k>YAL@XVQ`R;-h_}G-27?K;8`4^$Eh}S9oDr6Acd&rsvljM;`c=2O8zy zQM|{DsmrEPctDB2YpLugBK>#H{qw64+ZhY%xEOb4J)DE=M%$Ap&N8|vIzq^LUSBW* zjU8nldKaEm`yRZM#oX)@iiEjf7hLN%RLS(uMsLI9gianZefW`qLz2VftVBnimfhFoj2VEap6R-4Z0td;U<^P1mI9=?8`cvxD6 z-r@hk;mA*JI8(=cA-=&+$0tWP#t1cVuiqV-UibVa8>i0iF1kgR^N1&EPx&^JOuAQ% znGc&p=Xq$JopJWymt_1aZl319$D`|;T;!R+;s(<~1aZB}lWE+01y>yl>1!AL8m8;D z-LH5Ha)zsBZ=-w5^D55_;1LV10~@N5f0r+|3X*q!xWmI2Tt_x8?#U_jJn>vNVz-!h zB0#ViL9TJ~?C13xz5V0BWKH_KqP}SCezV*m)}5t$*>HkV!P32iJmh-9U)VjS1D0;1 zN>Ugb0r8Ku<*_nSSI&z~<&e`!3(Ah*;9woXD#|yx`*7mVQAv}L_)P^>6&01>)3@Tg zQ+@6Sm8jO-G7eA2ef6Rgy;t>5hR=h}3W zGU;(?(X5hxgEHtut)V|f?~PtPe8H=s7@0yMm7_Cl2@`q4ALh}dXbz${f-M!L_Nu`u zUOnEdcQRTrE5@8C2W2BC@tunvj~mg^L}^)@-HGH=O&r?cKRzUGv67A##pY*i;u2dd zSk)EJLU?|z)3VUCBj3Jgo_M41>t>=g6jS#=uT<~>FDs$$N{DiC*B43ySetpL=wxX@ z{O*1RDgM|ea)Xr#nD913T92@_`oVWu&dn&@r1oM7L&F(g?py>Wo#g>oCNiuBp8ixO zQj}ia^s7etPm^cY9=038%C{A}{PzENjM-#)+CVnO(Db#);^< z73A;r2-k06Rw=v%b{{Zrs(Nj>-W+j5J%jG;x8EAJt)s-b{>dG5BG}R7*zSjERDC|(fd16?AqklsBg<( z)9W`#a1sI2BZ?%N1*_o|`C%D2zFsNsWv02xs|90t-4TBca(ul*0yH;#pmo|qQ>0>M zrdG}zAT?s;~cMO3&){DF`Uv4o}C)dKXw`BTDJcquYONda%x} zl=8M7ni<}HynX!p^L$;G>!RS*z_U5=aro0&ox5uG7gXQyM9-N8+p_2T_|6i6_#zlXt6Luimxu}G zRFUxh^Xnc1WlatZ3zYQH)rH8klzy&Ym}6QBLfaYA44M38^pvj<07wfcU_AOl8X8;W zu+Nh3Z>T#;TfQB>f2`xwPqp%Pve#AZ$`xk!%ijVFZz6xKtJZ#jumQnLQZ0p2HwsfZ zqbMEHF_I9MS?`rTsoxdltS-ouc}a1^0@UTIj0v3x(Rjj!A1nqc)kB? z)bjpJyqlKdoW5%pAIzg75m@<(}mRW3A?2lG9}`Wa#zt zJPg~^XNU77ZgJ%SQ|cnVxJ7kYaP8WVi1MKRaWETeA;H^dYOh}k=7!c==li$Mq9Poz zP7BA*nL@v{*b0-^d$qo`6k6jqSEoe46z%(6O-@duI%JsO@0oS!kp+zzf3%8ahSaSl zo64`^CMv8Z7DXt?wRN6wWUAqye_!s2ZhnZzQ&%;H=NK>-GQAmkwQSwBP)zBadBd6c z7Vh@T_JhL1igs!`cbtgAgmWe@?Uclak9$1QZEc4x!$o*y@*2zJaMSLoS>k+lP4ycI zPxvk9_=eAj=}wo!CWl)mInfc4Dwamv3c5FKE;6gax?Vy)dkwa?+{=&u{dna64=+!vrykR^Li>sza@pAL$`<=A1(f--Pi%f} z3<=yQY|D^GJh@hov!3^>^>nI}_rjblgnZLm9qvL8DTP6))W2BL2!TKp1>#2W6_At$ZgM(9tPP)XLJ% zKFe2tp&g*IEponUxP{OD+S%DaK#N?RI&Rp~S35fw7z{i}0BG}3+Dzt%MdFH737;hG z>=!^wU>yS2R;B>gH$p7Z?C?Urjex->>D3c$FRwuv@&~!l0^r>nyCs^q*Ay^lRI0Jl z2s1cd4A5pmB1R}HQmelsVgNKe*gwBZ+rk)j3nu|}Tbba6X4-;MB~pO6A@-DiCSmZl zH2X?TT*6ImbPZIf?j{fZ!#60j7*=o!3P=PZ84++wI3D|v7>TplNRhAwf8F1Jf`^iv zQY5m0m2LJE3Ht`^>>42Pz(Ew6$v(t|mH_uG<)=zmn`z5~!S3+kELtd^C?4B=N`Tse zx-9(z&=C~OznrMTbR0#%nBI#egXeq7om4OFIztR_NdHO(aLHWac}HJ;KXhr}tsfG1 z-ygdy5Vp^o9&5sbZfI*X303c+g9q2W=+Mq4lh1AgY65*@f##a`U2DAQ?06L}JaHBv zpB)DzuH6=eejD5)?J;N5)5Iwb6pd=j7g-+gR|#Y$08k${c>dC}6z3c4;FlsU;?QsH z@Zj!hUwHZltR6gn;aLhII|XZxM!<#kSGp>#q!gt9QJ3lFnz( z#w!dX3GayuSw|2!{_=r&ZuDp~w2}Nt0`Peh_7~&396uBv;2&DEo4nie zeJ%87!^4BOboa*j@o5H1b3O%Ha$xsp^jx`w&aucN{F*oO5awXb_zvUT>`bE^b?+{5 zpp42x(hj{ZN9A3r9{Zw|RSID1_`te#8P!VOg{oca`Ra|slk zR~dH3*tOm~whgy71sVgrA=z@{=s`o<@wN4LLm+!-%s5 zSx0ut$<{9K#ItkyOTzQFS0_4}6+h}()c<_6+|>4|5m;Y$c7S$R*u8BqdgSKCZ~d}m zAO8LCU7tX(`xCWKj7eL(rgv(P#tD6Cd%@>Ym7WLX_GJMxnx?1J5jvmlp##A#Cp-&z z9Ye0XQ+H~5vm#!=ho^9ZM`HL1g>RN%_l**aBlzMz9t3UJQjY8JG!;Zwe&=H?F(*rr zFrr`#@nOz#L}m{KZy~exI7t(^3RF0LWZdE}n0eiM%*kwx_>K5PRbXD{4oQiMqqIsz0w4&^79STZBe`-zyU$C;>cf~lE+nR!xdo!vhi+0cO zr53mu6i${GEG-=QLbZP_Wf)oZhD#e6;MNH!EFUPp&_^fLt8?%MGv7hnQBr^;4Z>|&bOW^w5Ch@? zg&}u)f6O;BGVGUnS>H>23RGcrt0bab^=v zgs0r#A4iP2cvFEIfLWBhoC|6Nm!|mG_Itl9FaR8Y)h&(HidK+{1<1_7H^#=d%xeJ4H5|&^#;%1}`HsJjLv{ zC?l~@u&@i58m#-tQ5?TLm((kpBWbz)C7F<9!Za~j)EXD2T==d>#SfwB5-%N{r~iEY z(f;}T^{|sz$Pz&cttej84_FO+=`GxhB~Dfy{8Bf|v)JGR?yKbZH$(NPLnZ*jkL!!wb}QFqtPHzzB&GV zQa3el&;CZR=S(gyn+Wg9g~r!e_31Gu>I=%Lx4z(v0ez<}JELOS=_Ot^rrcQ+Z$+V2 z6InNk!0B(U+fFm5>6!D{7daW{TCI0f@B*nEOXly7t7qe_YNN{aX<}X?N~fK81;cP?a_fRYX9q5RKMa;-$@$)}ZgF}%n&k2D@W1()WtPkvK6{SvT7olyxD2yj#` z=Y)}h-8nZyg2C4C?|HA|9E+u7^7vKt5cOhx$I!Tyi2xib4X``>ysFovj$0BGQf+b` zbaH-?3Aovs?epgAIUj}2x8^N1c!^TJr{n!(ttk4va!atnWAchsNhHxlqC9DhKk>D* zzm5Gpl$dXEN}Nhc&$_$6>X(BAIXQoRjo$7brcrB3`Lr*ijO!77$T1S*8K3!)NRMcZ z2X~XEW0Si=!bu34gdiMMYRh`2HcMfYT;2TA#$q2qU!@$yMh-xzeOEYJBm@KZ?%AZ7 ziSnd_`ET?sH}aK z;-!NG-~dV;NFa;V5v5&%BdC)ZbJl<1`8y@`l%PhHnr?$0Pse*Hav; zb$qgjgZMMkaHla#WR(@pY(1ofF(o6rQCILtQndKv>1VKXjV4X}<|}n~6Iq;cx}we&iU>j7f_EvpeeOb4v|mJBu)6f>kYPP_5MGG zInjzbKs$_*QZ|$aqiYpz+a$~i3ncOkzRjq)5efMz@p6|E9Rg%Kk`6n?X@NdqRYJ%S zWH2AhBR48^&<2fGjE?hro8mw~O^JnCD+97)!g-hQwaqQKG>2H`JdQ?eWq%_)ByY}# zSYixv;jSFYgcF+b%2~F&APyK?uKvhhZI%gC#|2ac%D(|5@an3R=vS+DjvUl|SWhvN zU|!;tiOVPBI!ahmKt&uUYO(&srubNQqx9lvdXr~?U#U!vr^*8obxP_ z315)Q11S>BpTka{O0Xnf#h0?+tg7i)5GcS{s#f##`wGoT zb}bde*A;e9aV&qxDCmg# z2tlr(1lXoEvJWd79D$)WP?%$J*Qu*U6SYPJ4y6p-Cj;y$VJkvR1CCMYLrl1L#B{7l zZlW_KaVl8})dLB8Og{>&hqq#27217_X0$MU;mGoE8s{Y?1-tDR4t_twN0J8BnPRmH zJWXi}J_%{w2TAW*$MZ{<+Vnz_G+&MN6YisLs|ATMp*YwYf-o!Cg=JeFkQTnPb4jG#ixbJ$+Vn@OiB z&UXzGWI|`%>NBFVS7u{0jv7kzs@5N#y1oUBGU6-@RhaPa05)#(w%2~i}BEm2GP z^ymuk8xFcg(j>}=mdHu960{+0QDHepxzz=CgS1vBSgvak0rY|x8uuj#VfiTAcm1Mh zzsIdm<~PiWY+_;!uTH!dou{&z8K!BOT4pE3yDGJ4CBRof z?7pvHCgqecshojF*Y@TGD#P}|oh~svzEut8`fg97s-zLm@Z~B^R6rrfU_2T7g!%ap zv0b$&c>(KoZT4Got_6LdS`P4>O;2#{O=CXQAJn7Dq^Gefq&W{2f7}aTAvop0-#JT# z)s8^w_OPQa-j(;SCX<71<;=1aE;W#jmaq{pnpDh?gGOpp{W|31ir-)O12T!U{D3Hq1+j(oOk=Mu438s=Ge4+Fsq0M)sKy^jj!e_P-N zSC8HD-&-f?uImYV1}yk~V#wtj?4GZ>Aa3ja z^TfNGAja{th@h_FH?F{yXNpCR-w^qxcFy6|dI@!&AjYb&sX> zh_i;Y&t@gDd)$c-pH@FTt&ItpJ9R&(U{1G>mqLmqZTJkp5ov=Z%sg$nJhyD79{c+O zVa?x~N9I?96bC!CGkG z-0x~6YpX}%O*?%x!WwQh`ZtxqSPE7FB^%NPC=BJvc___4akfP6nJOS&GNZH7hi)zJ zV!Q#B{cBfaAxT>76zD*rpXq|n_uCiWKlf5n*c1Md(c15I)||(H4y-;ar@v+4g+meJ zn0ESFDX*7vWKU$qRS(3Eml%M%ZU-GRckrIf`hqUnKJ~jx5H_R@3ToKi!Y`iSYXOm+ zwTi*Y=TG)Qwst^FU!P9`AYK?al(eV)m`V)yf+ooU!WRtdAy>5J^*9n_KxZ-HB?Ys* zj#rIMxW4;BFidy>QnWHPFba`p{=bC?npC3?J2YpDMOGmxF*qHv<=z*TFr?cH@_3)0BGCt7xn|@ZA-89bXI6w}nKD z{z)%7DRe~=p|KIw#nD)8;P)EHJj(bD-Sq|0n;soS`XqoM8CsKCD;0zaXm--vpe!&I zWNY#hS-o9Mio=p4w8osOLEEu3FDMHv1lh93df7)koZ~&qBC1O;RvJ8xnFvYXD9ZT3 z{P24^-+|*G77!~t!0Ig@hqN$?A7{p`5kteqOTI}h%zjkc@P&x=;{{k?Rdl*ALZHHW zyX2s{!G1S&}9p&q^Y>L1Uv3T_HA$)rGJ_ z|3xJlS#ppt;h&p?5I_B-xi5#hDo9t8J~OgZ<*9>Q<-E=fQkG%k3NkF3 zxy2+nAq8@uE0(#AQ}s!;qrgAmwG> z81=DHZa7Uxz~OJaKtwfk(CK`0&px?UgQo7|cliOhj;7(Qw}`vp{}-i`;-dfn diff --git a/build.gradle b/build.gradle index de0602f084..2bfd7d8460 100644 --- a/build.gradle +++ b/build.gradle @@ -577,7 +577,7 @@ subprojects { dependency "org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.1" dependency "com.alibaba:druid-spring-boot-starter:1.2.22" dependency "org.springframework.boot:spring-boot-starter-jetty:2.7.10" - + dependency "com.baomidou:mybatis-plus:3.5.6" dependency "com.mysql:mysql-connector-j:8.0.33" } diff --git a/eventmesh-admin-server/build.gradle b/eventmesh-admin-server/build.gradle index e3ab6611b9..1ea66f59e8 100644 --- a/eventmesh-admin-server/build.gradle +++ b/eventmesh-admin-server/build.gradle @@ -3,6 +3,7 @@ dependencies { implementation project(":eventmesh-common") implementation project(":eventmesh-registry:eventmesh-registry-api") implementation project(":eventmesh-registry:eventmesh-registry-nacos") + implementation project(':eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api') implementation "com.alibaba.nacos:nacos-client" implementation ("org.springframework.boot:spring-boot-starter-web") { exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat" @@ -11,9 +12,12 @@ dependencies { implementation "io.grpc:grpc-core" implementation "io.grpc:grpc-protobuf" implementation "io.grpc:grpc-stub" + implementation "io.grpc:grpc-netty-shaded" + // https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter + implementation group: 'com.baomidou', name: 'mybatis-plus-boot-starter', version: '3.5.5' + implementation "org.reflections:reflections:0.10.2" - implementation "org.mybatis.spring.boot:mybatis-spring-boot-starter" // https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter implementation "com.alibaba:druid-spring-boot-starter" runtimeOnly 'com.mysql:mysql-connector-j' diff --git a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/config/DingDingConnectServerConfig.java b/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/config/DingDingConnectServerConfig.java index ec744922c2..d9657bc23b 100644 --- a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/config/DingDingConnectServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/config/DingDingConnectServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.dingtalk.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/DingDingSinkConfig.java b/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/DingDingSinkConfig.java deleted file mode 100644 index aa4245219f..0000000000 --- a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/DingDingSinkConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.dingtalk.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class DingDingSinkConfig extends SinkConfig { - - private SinkConnectorConfig sinkConnectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 2211fd1adc..0000000000 --- a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.connector.dingtalk.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String appKey; - - private String appSecret; - - private String openConversationId; - - private String robotCode; - - private String coolAppCode; -} diff --git a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnector.java b/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnector.java index 754461875f..417d9cef36 100644 --- a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnector.java @@ -17,11 +17,11 @@ package org.apache.eventmesh.connector.dingtalk.sink.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.dingtalk.DingDingSinkConfig; import org.apache.eventmesh.common.utils.JsonUtils; import org.apache.eventmesh.connector.dingtalk.common.constants.ConnectRecordExtensionKeys; import org.apache.eventmesh.connector.dingtalk.config.DingDingMessageTemplateType; -import org.apache.eventmesh.connector.dingtalk.sink.config.DingDingSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-dingtalk/src/test/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-dingtalk/src/test/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnectorTest.java index 38a136748c..7c9a37ecf6 100644 --- a/eventmesh-connectors/eventmesh-connector-dingtalk/src/test/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-dingtalk/src/test/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnectorTest.java @@ -21,12 +21,12 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import org.apache.eventmesh.common.config.connector.dingtalk.DingDingSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.connector.dingtalk.common.constants.ConnectRecordExtensionKeys; import org.apache.eventmesh.connector.dingtalk.config.DingDingMessageTemplateType; -import org.apache.eventmesh.connector.dingtalk.sink.config.DingDingSinkConfig; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.ConfigUtil; import java.lang.reflect.Field; diff --git a/eventmesh-connectors/eventmesh-connector-file/build.gradle b/eventmesh-connectors/eventmesh-connector-file/build.gradle index 11eaa5b7e0..d9b6aa7668 100644 --- a/eventmesh-connectors/eventmesh-connector-file/build.gradle +++ b/eventmesh-connectors/eventmesh-connector-file/build.gradle @@ -16,6 +16,7 @@ */ dependencies { + implementation project(":eventmesh-common") api project(":eventmesh-openconnect:eventmesh-openconnect-java") testImplementation('org.junit.jupiter:junit-jupiter') testImplementation('org.mockito:mockito-junit-jupiter') diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/config/FileServerConfig.java b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/config/FileServerConfig.java index b6b506521e..ad25b8a410 100644 --- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/config/FileServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/config/FileServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.file.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/FileSinkConfig.java b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/FileSinkConfig.java deleted file mode 100644 index abdae52770..0000000000 --- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/FileSinkConfig.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.connector.file.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class FileSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; - - private Integer flushSize = 1000; - - private boolean hourlyFlushEnabled = false; - -} diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/SinkConnectorConfig.java deleted file mode 100644 index a8cf958f7f..0000000000 --- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.connector.file.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String topic; -} diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/connector/FileSinkConnector.java b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/connector/FileSinkConnector.java index f1d1ccc57b..89222b35b0 100644 --- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/connector/FileSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/connector/FileSinkConnector.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.file.sink.connector; -import org.apache.eventmesh.connector.file.sink.config.FileSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.file.FileSinkConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/FileSourceConfig.java b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/FileSourceConfig.java deleted file mode 100644 index b969544403..0000000000 --- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/FileSourceConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.file.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class FileSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/SourceConnectorConfig.java deleted file mode 100644 index 6376a7fb4a..0000000000 --- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.connector.file.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String filePath; -} diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/connector/FileSourceConnector.java b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/connector/FileSourceConnector.java index 2b55284741..dfd166c895 100644 --- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/connector/FileSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/connector/FileSourceConnector.java @@ -17,13 +17,14 @@ package org.apache.eventmesh.connector.file.source.connector; -import org.apache.eventmesh.connector.file.source.config.FileSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.file.FileSourceConfig; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.file.FileRecordPartition; import java.io.BufferedReader; import java.io.File; @@ -34,9 +35,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import lombok.extern.slf4j.Slf4j; @@ -118,9 +117,10 @@ public List poll() { } public static RecordPartition convertToRecordPartition(String fileName) { - Map map = new HashMap<>(); - map.put("fileName", fileName); - return new RecordPartition(map); + FileRecordPartition fileRecordPartition = new FileRecordPartition(); + fileRecordPartition.setFileName(fileName); + fileRecordPartition.setClazz(fileRecordPartition.getRecordPartitionClass()); + return fileRecordPartition; } private static String getFileName(String filePath) throws NullPointerException { diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/config/HttpServerConfig.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/config/HttpServerConfig.java index 81a9f20923..8517b869fd 100644 --- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/config/HttpServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/config/HttpServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.http.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/HttpSourceConfig.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/HttpSourceConfig.java deleted file mode 100644 index bee870cb1a..0000000000 --- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/HttpSourceConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.http.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class HttpSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/SourceConnectorConfig.java deleted file mode 100644 index 873a0d1922..0000000000 --- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.connector.http.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String path; - - private int port; - - private int idleTimeout; -} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnector.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnector.java index f9a6c568e0..c0f518ae2e 100644 --- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnector.java @@ -17,9 +17,10 @@ package org.apache.eventmesh.connector.http.source.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.http.HttpSourceConfig; import org.apache.eventmesh.common.exception.EventMeshException; -import org.apache.eventmesh.connector.http.source.config.HttpSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; + import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; diff --git a/eventmesh-connectors/eventmesh-connector-http/src/test/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnectorTest.java b/eventmesh-connectors/eventmesh-connector-http/src/test/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnectorTest.java index 35d58b75c1..3136045048 100644 --- a/eventmesh-connectors/eventmesh-connector-http/src/test/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-http/src/test/java/org/apache/eventmesh/connector/http/source/connector/HttpSourceConnectorTest.java @@ -17,9 +17,10 @@ package org.apache.eventmesh.connector.http.source.connector; +import org.apache.eventmesh.common.config.connector.http.HttpSourceConfig; +import org.apache.eventmesh.common.config.connector.http.SourceConnectorConfig; import org.apache.eventmesh.common.utils.JsonUtils; -import org.apache.eventmesh.connector.http.source.config.HttpSourceConfig; -import org.apache.eventmesh.connector.http.source.config.SourceConnectorConfig; + import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; import org.apache.eventmesh.openconnect.util.ConfigUtil; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcConfig.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcConfig.java deleted file mode 100644 index d40801854c..0000000000 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcConfig.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.connector.jdbc.config; - -import java.util.Properties; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * Represents the configuration for a JDBC connection. - */ -@AllArgsConstructor -@NoArgsConstructor -@Data -public class JdbcConfig { - - private String databaseName; - - // The hostname of the database server. - private String hostname; - - // The port number of the database server. - private int port; - - // The username for the database connection. - private String user; - - // The password for the database connection. - private String password; - - private String initialStatements; - - private int connectTimeout; - - // e.g jdbc:mysql://127.0.0.1:3306 - private String url; - - /** - * Converts the JdbcConfig object to a Properties object containing the user and password. - * - * @return The Properties object representing the JdbcConfig. - */ - public Properties asProperties() { - Properties props = new Properties(); - props.put("user", this.user); - props.put("password", this.password); - return props; - } -} diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcServerConfig.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcServerConfig.java index 451ecf71e9..2b3e614774 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcServerConfig.java @@ -17,7 +17,8 @@ package org.apache.eventmesh.connector.jdbc.config; -import org.apache.eventmesh.openconnect.api.config.Config; + +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/JdbcConnection.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/JdbcConnection.java index d1802d8b96..70d553517f 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/JdbcConnection.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/JdbcConnection.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.jdbc.connection; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcConfig; import org.apache.eventmesh.connector.jdbc.JdbcDriverMetaData; -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; import org.apache.commons.lang3.StringUtils; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/mysql/MysqlJdbcConnection.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/mysql/MysqlJdbcConnection.java index 2a7514c09a..d62aebba56 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/mysql/MysqlJdbcConnection.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/mysql/MysqlJdbcConnection.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.jdbc.connection.mysql; -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcConfig; import org.apache.eventmesh.connector.jdbc.connection.JdbcConnection; import org.apache.eventmesh.connector.jdbc.source.dialect.mysql.MysqlDialectSql; import org.apache.eventmesh.connector.jdbc.table.catalog.TableId; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/AbstractGeneralDatabaseDialect.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/AbstractGeneralDatabaseDialect.java index 0a7463a187..0ba6ab715f 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/AbstractGeneralDatabaseDialect.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/AbstractGeneralDatabaseDialect.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.jdbc.dialect; -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcConfig; import org.apache.eventmesh.connector.jdbc.connection.JdbcConnection; import org.apache.eventmesh.connector.jdbc.exception.JdbcConnectionException; import org.apache.eventmesh.connector.jdbc.table.catalog.Column; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/DatabaseDialectFactory.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/DatabaseDialectFactory.java index aad7984520..3ad607e455 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/DatabaseDialectFactory.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/DatabaseDialectFactory.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.jdbc.dialect; -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcConfig; import org.apache.eventmesh.spi.EventMeshExtensionType; import org.apache.eventmesh.spi.EventMeshSPI; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialect.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialect.java index acd8730c2e..1a4bb02fb6 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialect.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialect.java @@ -17,9 +17,9 @@ package org.apache.eventmesh.connector.jdbc.dialect.mysql; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcConfig; import org.apache.eventmesh.connector.jdbc.DataTypeConvertor; import org.apache.eventmesh.connector.jdbc.JdbcDriverMetaData; -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; import org.apache.eventmesh.connector.jdbc.connection.mysql.MysqlJdbcConnection; import org.apache.eventmesh.connector.jdbc.dialect.AbstractGeneralDatabaseDialect; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseType; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialectFactory.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialectFactory.java index eb4fbe3275..b5fb87a016 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialectFactory.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialectFactory.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.jdbc.dialect.mysql; -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcConfig; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialect; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialectFactory; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/JdbcSinkConnector.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/JdbcSinkConnector.java index 7a5c68f581..39681bf179 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/JdbcSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/JdbcSinkConnector.java @@ -17,17 +17,17 @@ package org.apache.eventmesh.connector.jdbc.sink; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcConfig; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcSinkConfig; import org.apache.eventmesh.common.utils.JsonUtils; import org.apache.eventmesh.connector.jdbc.JdbcConnectData; -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialect; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialectFactory; -import org.apache.eventmesh.connector.jdbc.sink.config.JdbcSinkConfig; import org.apache.eventmesh.connector.jdbc.sink.handle.DefaultSinkRecordHandler; import org.apache.eventmesh.connector.jdbc.sink.handle.SinkRecordHandler; import org.apache.eventmesh.connector.jdbc.sink.hibernate.HibernateConfiguration; import org.apache.eventmesh.connector.jdbc.source.JdbcAllFactoryLoader; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/JdbcSinkConfig.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/JdbcSinkConfig.java deleted file mode 100644 index 2a5af32cad..0000000000 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/JdbcSinkConfig.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.connector.jdbc.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class JdbcSinkConfig extends SinkConfig { - - private boolean supportUpsert = true; - - private boolean supportDelete = true; - - public SinkConnectorConfig sinkConnectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/SinkConnectorConfig.java deleted file mode 100644 index e971b7b000..0000000000 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.connector.jdbc.sink.config; - -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; - -import lombok.Data; - -/** - * Configuration parameters for a sink connector. - */ -@Data -public class SinkConnectorConfig { - - /** - * The name of the sink connector. - */ - private String connectorName; - - /** - * JDBC configuration for connecting to a database. - */ - private JdbcConfig jdbcConfig; - - public String getDatabaseType() { - return "mysql"; - } -} diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/handle/DefaultSinkRecordHandler.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/handle/DefaultSinkRecordHandler.java index a4ba77ae5d..db684d63c7 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/handle/DefaultSinkRecordHandler.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/handle/DefaultSinkRecordHandler.java @@ -17,6 +17,7 @@ package org.apache.eventmesh.connector.jdbc.sink.handle; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcSinkConfig; import org.apache.eventmesh.common.utils.LogUtil; import org.apache.eventmesh.connector.jdbc.CatalogChanges; import org.apache.eventmesh.connector.jdbc.DataChanges; @@ -28,7 +29,6 @@ import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialect; import org.apache.eventmesh.connector.jdbc.event.DataChangeEventType; import org.apache.eventmesh.connector.jdbc.event.SchemaChangeEventType; -import org.apache.eventmesh.connector.jdbc.sink.config.JdbcSinkConfig; import org.apache.eventmesh.connector.jdbc.source.SourceMateData; import org.apache.eventmesh.connector.jdbc.table.catalog.Column; import org.apache.eventmesh.connector.jdbc.type.Type; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/JdbcSourceConnector.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/JdbcSourceConnector.java index 8d7d9cb66d..2b2efcbef2 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/JdbcSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/JdbcSourceConnector.java @@ -17,10 +17,12 @@ package org.apache.eventmesh.connector.jdbc.source; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.SourceConfig; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcSourceConfig; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialect; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialectFactory; import org.apache.eventmesh.connector.jdbc.event.Event; -import org.apache.eventmesh.connector.jdbc.source.config.JdbcSourceConfig; import org.apache.eventmesh.connector.jdbc.source.dialect.cdc.CdcEngine; import org.apache.eventmesh.connector.jdbc.source.dialect.cdc.CdcEngineFactory; import org.apache.eventmesh.connector.jdbc.source.dialect.snapshot.SnapshotEngine; @@ -28,8 +30,6 @@ import org.apache.eventmesh.connector.jdbc.source.dialect.snapshot.SnapshotResult; import org.apache.eventmesh.connector.jdbc.source.dialect.snapshot.SnapshotResult.SnapshotResultStatus; import org.apache.eventmesh.connector.jdbc.table.catalog.TableId; -import org.apache.eventmesh.openconnect.api.config.Config; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnector; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/SourceJdbcTaskManager.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/SourceJdbcTaskManager.java index be38ffb75a..2d0584a5e7 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/SourceJdbcTaskManager.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/SourceJdbcTaskManager.java @@ -17,15 +17,15 @@ package org.apache.eventmesh.connector.jdbc.source; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcSourceConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.connector.jdbc.JdbcConnectData; import org.apache.eventmesh.connector.jdbc.event.Event; -import org.apache.eventmesh.connector.jdbc.source.config.JdbcSourceConfig; import org.apache.eventmesh.connector.jdbc.source.dialect.cdc.RandomTaskSelectStrategy; import org.apache.eventmesh.connector.jdbc.source.dialect.cdc.TaskSelectStrategy; import org.apache.eventmesh.connector.jdbc.table.catalog.TableId; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import java.util.Collections; import java.util.HashSet; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/JdbcSourceConfig.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/JdbcSourceConfig.java deleted file mode 100644 index b330c331bf..0000000000 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/JdbcSourceConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.jdbc.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class JdbcSourceConfig extends SourceConfig { - - private SourceConnectorConfig sourceConnectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/MysqlConfig.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/MysqlConfig.java deleted file mode 100644 index 032921350f..0000000000 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/MysqlConfig.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.connector.jdbc.source.config; - -import lombok.Data; - -@Data -public class MysqlConfig { - - private int serverId; - - private boolean keepAlive = true; - - private long keepAliveInterval; - - private SnapshotLockingMode snapshotLockingMode = SnapshotLockingMode.MINIMAL; - - private boolean useGlobalLock = true; - - public enum SnapshotLockingMode { - - EXTENDED("extended"), - - MINIMAL("minimal"), - - NONE("none"); - - private final String value; - - SnapshotLockingMode(String value) { - this.value = value; - } - - public boolean usesLocking() { - return !value.equals(NONE.value); - } - } - -} diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/SourceConnectorConfig.java deleted file mode 100644 index a27dbfedb4..0000000000 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.connector.jdbc.source.config; - -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; - -import java.util.List; - -import lombok.Data; - -/** - * Represents the configuration for a database connector. - */ -@Data -public class SourceConnectorConfig { - - private static final int DEFAULT_SNAPSHOT_FETCH_SIZE = 100; - - /** - * Max task number,The maximum cannot exceed the number of tables scanned. If it exceeds, it will be set to the number of tables. - */ - private int maxTask; - - private int batchMaxRows; - - private boolean skipSnapshot = false; - - // A list of database names to include in the connector. - private List databaseIncludeList; - - // A list of database names to exclude from the connector. - private List databaseExcludeList; - - // A list of table names to include in the connector. - private List tableIncludeList; - - // A list of table names to exclude from the connector. - private List tableExcludeList; - - // database type e.g. mysql - private String databaseType; - - private int snapshotMaxThreads; - - // The snapshot mode also require handling the database schema (database and table schema) - private boolean snapshotSchema = true; - - // The snapshot mode require handling table data - private boolean snapshotData = true; - - private int snapshotFetchSize = DEFAULT_SNAPSHOT_FETCH_SIZE; - - private JdbcConfig jdbcConfig; - - private boolean skipViews = false; - - private boolean skipComments = false; - - // The configuration for the MySQL database. - private MysqlConfig mysqlConfig; - - private String name = "mysql-connector"; -} diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/AbstractCdcEngine.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/AbstractCdcEngine.java index 1fb1a95579..5cde890045 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/AbstractCdcEngine.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/AbstractCdcEngine.java @@ -18,13 +18,13 @@ package org.apache.eventmesh.connector.jdbc.source.dialect.cdc; import org.apache.eventmesh.common.ThreadWrapper; +import org.apache.eventmesh.common.config.connector.SourceConfig; import org.apache.eventmesh.connector.jdbc.JdbcContext; import org.apache.eventmesh.connector.jdbc.ddl.DdlParser; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialect; import org.apache.eventmesh.connector.jdbc.source.config.JdbcSourceConfig; import org.apache.eventmesh.connector.jdbc.source.config.SourceConnectorConfig; import org.apache.eventmesh.connector.jdbc.table.catalog.TableId; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; import org.apache.commons.collections4.CollectionUtils; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/CdcEngineFactory.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/CdcEngineFactory.java index e08e1c8216..d53499e147 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/CdcEngineFactory.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/CdcEngineFactory.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.jdbc.source.dialect.cdc; +import org.apache.eventmesh.common.config.connector.SourceConfig; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialect; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; import org.apache.eventmesh.spi.EventMeshExtensionType; import org.apache.eventmesh.spi.EventMeshSPI; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java index 5650c3d0cc..58a181018d 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java @@ -18,13 +18,13 @@ package org.apache.eventmesh.connector.jdbc.source.dialect.cdc.mysql; import org.apache.eventmesh.common.EventMeshThreadFactory; +import org.apache.eventmesh.common.config.connector.Config; import org.apache.eventmesh.connector.jdbc.CatalogChanges; import org.apache.eventmesh.connector.jdbc.DataChanges; import org.apache.eventmesh.connector.jdbc.DataChanges.Builder; import org.apache.eventmesh.connector.jdbc.Field; import org.apache.eventmesh.connector.jdbc.Payload; import org.apache.eventmesh.connector.jdbc.Schema; -import org.apache.eventmesh.connector.jdbc.config.JdbcConfig; import org.apache.eventmesh.connector.jdbc.connection.mysql.MysqlJdbcConnection; import org.apache.eventmesh.connector.jdbc.dialect.mysql.MysqlDatabaseDialect; import org.apache.eventmesh.connector.jdbc.event.DeleteDataEvent; @@ -51,7 +51,6 @@ import org.apache.eventmesh.connector.jdbc.table.catalog.TableSchema; import org.apache.eventmesh.connector.jdbc.table.catalog.mysql.MysqlDefaultValueConvertorImpl; import org.apache.eventmesh.connector.jdbc.table.type.Pair; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngineFactory.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngineFactory.java index 35e722fe12..2a87969cf8 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngineFactory.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngineFactory.java @@ -17,12 +17,12 @@ package org.apache.eventmesh.connector.jdbc.source.dialect.cdc.mysql; +import org.apache.eventmesh.common.config.connector.SourceConfig; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialect; import org.apache.eventmesh.connector.jdbc.dialect.mysql.MysqlDatabaseDialect; import org.apache.eventmesh.connector.jdbc.source.dialect.cdc.AbstractCdcEngineFactory; import org.apache.eventmesh.connector.jdbc.source.dialect.cdc.CdcEngine; import org.apache.eventmesh.connector.jdbc.source.dialect.cdc.CdcEngineFactory; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; import org.apache.commons.lang3.StringUtils; diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/snapshot/SnapshotEngineFactory.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/snapshot/SnapshotEngineFactory.java index d573d7081a..30dfe2e997 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/snapshot/SnapshotEngineFactory.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/snapshot/SnapshotEngineFactory.java @@ -17,9 +17,9 @@ package org.apache.eventmesh.connector.jdbc.source.dialect.snapshot; +import org.apache.eventmesh.common.config.connector.rdb.jdbc.JdbcSourceConfig; import org.apache.eventmesh.connector.jdbc.JdbcContext; import org.apache.eventmesh.connector.jdbc.dialect.DatabaseDialect; -import org.apache.eventmesh.connector.jdbc.source.config.JdbcSourceConfig; import org.apache.eventmesh.spi.EventMeshExtensionType; import org.apache.eventmesh.spi.EventMeshSPI; diff --git a/eventmesh-connectors/eventmesh-connector-kafka/build.gradle b/eventmesh-connectors/eventmesh-connector-kafka/build.gradle index 98176995bd..8a0b9f0723 100644 --- a/eventmesh-connectors/eventmesh-connector-kafka/build.gradle +++ b/eventmesh-connectors/eventmesh-connector-kafka/build.gradle @@ -16,6 +16,7 @@ */ dependencies { + implementation project(":eventmesh-common") implementation project(":eventmesh-openconnect:eventmesh-openconnect-java") implementation 'io.cloudevents:cloudevents-kafka:2.4.2' implementation 'org.apache.kafka:kafka-clients:3.0.0' diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/config/KafkaServerConfig.java b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/config/KafkaServerConfig.java index 2c9ef71fb4..ccbabf2676 100644 --- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/config/KafkaServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/config/KafkaServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.kafka.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/KafkaSinkConfig.java b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/KafkaSinkConfig.java deleted file mode 100644 index 9bb79551db..0000000000 --- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/KafkaSinkConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.connector.kafka.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; - -@Data -public class KafkaSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/SinkConnectorConfig.java deleted file mode 100644 index a240bf4f49..0000000000 --- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.connector.kafka.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName = "kafkaSink"; - private String topic = "TopicTest"; - private String ack = "all"; - private String bootstrapServers = "127.0.0.1:9092"; - private String keyConverter = "org.apache.kafka.common.serialization.StringSerializer"; - private String valueConverter = "org.apache.kafka.common.serialization.StringSerializer"; - private String maxRequestSize = "1048576"; - private String bufferMemory = "33554432"; - private String batchSize = "16384"; - private String lingerMs = "0"; - private String requestTimeoutMs = "30000"; - private String maxInFightRequestsPerConnection = "5"; - private String retries = "0"; - private String compressionType = "none"; -} diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/connector/KafkaSinkConnector.java b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/connector/KafkaSinkConnector.java index 49b7e88f19..b257cd0f44 100644 --- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/connector/KafkaSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/connector/KafkaSinkConnector.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.kafka.sink.connector; -import org.apache.eventmesh.connector.kafka.sink.config.KafkaSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.mq.kafka.KafkaSinkConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/KafkaSourceConfig.java b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/KafkaSourceConfig.java deleted file mode 100644 index 4319ec96d7..0000000000 --- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/KafkaSourceConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.connector.kafka.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; - -@Data -public class KafkaSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/SourceConnectorConfig.java deleted file mode 100644 index 2d2f52f85c..0000000000 --- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.connector.kafka.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName = "kafkaSource"; - private String topic = "TopicTest"; - private String bootstrapServers = "127.0.0.1:9092"; - private String groupID = "kafkaSource"; - private String keyConverter = "org.apache.kafka.common.serialization.StringDeserializer"; - private String valueConverter = "org.apache.kafka.common.serialization.StringDeserializer"; - private String autoCommitIntervalMS = "1000"; - private String enableAutoCommit = "false"; - private String sessionTimeoutMS = "10000"; - private String maxPollRecords = "1000"; - private int pollTimeOut = 100; -} diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/connector/KafkaSourceConnector.java b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/connector/KafkaSourceConnector.java index 99fa73b580..d89bcb7030 100644 --- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/connector/KafkaSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/connector/KafkaSourceConnector.java @@ -17,14 +17,16 @@ package org.apache.eventmesh.connector.kafka.source.connector; -import org.apache.eventmesh.connector.kafka.source.config.KafkaSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.mq.kafka.KafkaSourceConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.kafka.KafkaRecordOffset; +import org.apache.eventmesh.common.remote.offset.kafka.KafkaRecordPartition; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.consumer.ConsumerRecord; @@ -34,9 +36,7 @@ import java.time.Duration; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Properties; public class KafkaSourceConnector implements Source { @@ -118,15 +118,17 @@ public List poll() { } public static RecordOffset convertToRecordOffset(Long offset) { - Map offsetMap = new HashMap<>(); - offsetMap.put("queueOffset", offset + ""); - return new RecordOffset(offsetMap); + KafkaRecordOffset recordOffset = new KafkaRecordOffset(); + recordOffset.setOffset(offset); + recordOffset.setClazz(recordOffset.getRecordOffsetClass()); + return recordOffset; } public static RecordPartition convertToRecordPartition(String topic, int partition) { - Map map = new HashMap<>(); - map.put("topic", topic); - map.put("partition", String.valueOf(partition)); - return new RecordPartition(map); + KafkaRecordPartition recordPartition = new KafkaRecordPartition(); + recordPartition.setTopic(topic); + recordPartition.setPartition(partition); + recordPartition.setClazz(recordPartition.getRecordPartitionClass()); + return recordPartition; } } diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/config/KnativeServerConfig.java b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/config/KnativeServerConfig.java index 4125132ad7..9469a5d4b5 100644 --- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/config/KnativeServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/config/KnativeServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.knative.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/KnativeSinkConfig.java b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/KnativeSinkConfig.java deleted file mode 100644 index 85bb38a90b..0000000000 --- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/KnativeSinkConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.knative.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class KnativeSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 5694c643f8..0000000000 --- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.knative.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - public String emurl; - - public String serviceAddr; - -} diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/connector/KnativeSinkConnector.java b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/connector/KnativeSinkConnector.java index fdf5b1056b..a12a1c7461 100644 --- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/connector/KnativeSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/connector/KnativeSinkConnector.java @@ -19,10 +19,10 @@ import static org.asynchttpclient.Dsl.asyncHttpClient; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.knative.KnativeSinkConfig; import org.apache.eventmesh.connector.knative.cloudevent.KnativeHeaders; import org.apache.eventmesh.connector.knative.cloudevent.KnativeMessageFactory; -import org.apache.eventmesh.connector.knative.sink.config.KnativeSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/KnativeSourceConfig.java b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/KnativeSourceConfig.java deleted file mode 100644 index 8ef36a8d78..0000000000 --- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/KnativeSourceConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.knative.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class KnativeSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/SourceConnectorConfig.java deleted file mode 100644 index 8d21c86b7b..0000000000 --- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.knative.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - public String emurl; - - public String serviceAddr; - -} \ No newline at end of file diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/connector/KnativeSourceConnector.java b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/connector/KnativeSourceConnector.java index 239c39a802..537c1ad4d9 100644 --- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/connector/KnativeSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/connector/KnativeSourceConnector.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.knative.source.connector; -import org.apache.eventmesh.connector.knative.source.config.KnativeSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.knative.KnativeSourceConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/config/LarkConnectServerConfig.java b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/config/LarkConnectServerConfig.java index 6d0428056e..0106fa4a65 100644 --- a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/config/LarkConnectServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/config/LarkConnectServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.lark.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandler.java b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandler.java index 75e51e690b..ce5d4a3b85 100644 --- a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandler.java +++ b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandler.java @@ -19,9 +19,9 @@ import static org.apache.eventmesh.connector.lark.sink.connector.LarkSinkConnector.getTenantAccessToken; +import org.apache.eventmesh.common.config.connector.lark.SinkConnectorConfig; import org.apache.eventmesh.connector.lark.ConnectRecordExtensionKeys; import org.apache.eventmesh.connector.lark.config.LarkMessageTemplateType; -import org.apache.eventmesh.connector.lark.sink.config.SinkConnectorConfig; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; import org.apache.commons.text.StringEscapeUtils; diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/LarkSinkConfig.java b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/LarkSinkConfig.java deleted file mode 100644 index a97ece91b0..0000000000 --- a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/LarkSinkConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.lark.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class LarkSinkConfig extends SinkConfig { - - public SinkConnectorConfig sinkConnectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/SinkConnectorConfig.java deleted file mode 100644 index cde3aa6737..0000000000 --- a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.connector.lark.sink.config; - -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; - -import org.apache.commons.lang3.StringUtils; - -import com.lark.oapi.service.im.v1.enums.ReceiveIdTypeEnum; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName = "larkSink"; - - /** - * Can not be blank - */ - private String appId; - - /** - * Can not be blank - */ - private String appSecret; - - /** - * The value is {@code open_id/user_id/union_id/email/chat_id}. - * Recommend to use open_id. - */ - private String receiveIdType = "open_id"; - - /** - * Can not be blank.And it needs to correspond to {@code receiveIdType} - */ - private String receiveId; - - /** - * When sinking CouldEvent to lark, choose to call - * {@link org.apache.eventmesh.connector.lark.sink.ImServiceHandler#sink(ConnectRecord)} - * or {@link org.apache.eventmesh.connector.lark.sink.ImServiceHandler#sinkAsync(ConnectRecord)} - */ - private String sinkAsync = "true"; - - private String maxRetryTimes = "3"; - - private String retryDelayInMills = "1000"; - - public void validateSinkConfiguration() { - // validate blank - if (StringUtils.isAnyBlank(appId, appSecret, receiveId)) { - throw new IllegalArgumentException("appId or appSecret or receiveId is blank,please check it."); - } - - // validate receiveIdType - if (!StringUtils.containsAny(receiveIdType, ReceiveIdTypeEnum.CHAT_ID.getValue(), - ReceiveIdTypeEnum.EMAIL.getValue(), - ReceiveIdTypeEnum.OPEN_ID.getValue(), - ReceiveIdTypeEnum.USER_ID.getValue(), - ReceiveIdTypeEnum.UNION_ID.getValue())) { - throw new IllegalArgumentException( - String.format("sinkConnectorConfig.receiveIdType=[%s], Invalid.", receiveIdType)); - } - } -} diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/connector/LarkSinkConnector.java b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/connector/LarkSinkConnector.java index d1ee1caa40..d340dffd13 100644 --- a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/connector/LarkSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/connector/LarkSinkConnector.java @@ -19,10 +19,11 @@ import static org.apache.eventmesh.connector.lark.sink.ImServiceHandler.create; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.lark.LarkSinkConfig; +import org.apache.eventmesh.common.config.connector.lark.SinkConnectorConfig; +import org.apache.eventmesh.connector.lark.ConfigUtils; import org.apache.eventmesh.connector.lark.sink.ImServiceHandler; -import org.apache.eventmesh.connector.lark.sink.config.LarkSinkConfig; -import org.apache.eventmesh.connector.lark.sink.config.SinkConnectorConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; @@ -87,7 +88,7 @@ public void init(ConnectorContext connectorContext) { this.sinkConfig = (LarkSinkConfig) sinkConnectorContext.getSinkConfig(); SinkConnectorConfig sinkConnectorConfig = sinkConfig.getSinkConnectorConfig(); - sinkConnectorConfig.validateSinkConfiguration(); + ConfigUtils.validateSinkConfiguration(sinkConnectorConfig); imServiceHandler = create(sinkConnectorConfig); } diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/test/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandlerTest.java b/eventmesh-connectors/eventmesh-connector-lark/src/test/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandlerTest.java index f72232a533..53d7ba6111 100644 --- a/eventmesh-connectors/eventmesh-connector-lark/src/test/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandlerTest.java +++ b/eventmesh-connectors/eventmesh-connector-lark/src/test/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandlerTest.java @@ -27,11 +27,11 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.apache.eventmesh.connector.lark.sink.config.LarkSinkConfig; -import org.apache.eventmesh.connector.lark.sink.config.SinkConnectorConfig; +import org.apache.eventmesh.common.config.connector.lark.LarkSinkConfig; +import org.apache.eventmesh.common.config.connector.lark.SinkConnectorConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.ConfigUtil; import java.lang.reflect.Field; diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/test/java/org/apache/eventmesh/connector/lark/sink/LarkSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-lark/src/test/java/org/apache/eventmesh/connector/lark/sink/LarkSinkConnectorTest.java index 658fa89223..8e31108f61 100644 --- a/eventmesh-connectors/eventmesh-connector-lark/src/test/java/org/apache/eventmesh/connector/lark/sink/LarkSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-lark/src/test/java/org/apache/eventmesh/connector/lark/sink/LarkSinkConnectorTest.java @@ -24,12 +24,12 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.apache.eventmesh.connector.lark.sink.config.LarkSinkConfig; +import org.apache.eventmesh.common.config.connector.lark.LarkSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.connector.lark.sink.connector.LarkSinkConnector; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.ConfigUtil; import java.nio.charset.StandardCharsets; diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/config/MongodbServerConfig.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/config/MongodbServerConfig.java index 95c651b358..fa5618d4a8 100644 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/config/MongodbServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/config/MongodbServerConfig.java @@ -17,10 +17,12 @@ package org.apache.eventmesh.connector.mongodb.config; +import org.apache.eventmesh.common.config.connector.Config; + import lombok.Data; @Data -public class MongodbServerConfig { +public class MongodbServerConfig extends Config { private boolean sourceEnable; diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/client/MongodbReplicaSetSinkClient.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/client/MongodbReplicaSetSinkClient.java index 638e1a7d3f..ea7efecbb8 100644 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/client/MongodbReplicaSetSinkClient.java +++ b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/client/MongodbReplicaSetSinkClient.java @@ -18,7 +18,7 @@ package org.apache.eventmesh.connector.mongodb.sink.client; import org.apache.eventmesh.connector.mongodb.sink.client.Impl.MongodbSinkClient; -import org.apache.eventmesh.connector.mongodb.sink.config.SinkConnectorConfig; +import org.apache.eventmesh.common.config.connector.rdb.mongodb.SinkConnectorConfig; import org.apache.eventmesh.connector.mongodb.utils.MongodbCloudEventUtil; import org.bson.Document; diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/client/MongodbStandaloneSinkClient.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/client/MongodbStandaloneSinkClient.java index 45bdf6f699..1fce037eca 100644 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/client/MongodbStandaloneSinkClient.java +++ b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/client/MongodbStandaloneSinkClient.java @@ -19,7 +19,7 @@ import org.apache.eventmesh.connector.mongodb.constant.MongodbConstants; import org.apache.eventmesh.connector.mongodb.sink.client.Impl.MongodbSinkClient; -import org.apache.eventmesh.connector.mongodb.sink.config.SinkConnectorConfig; +import org.apache.eventmesh.common.config.connector.rdb.mongodb.SinkConnectorConfig; import org.apache.eventmesh.connector.mongodb.utils.MongodbCloudEventUtil; import org.bson.Document; diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/MongodbSinkConfig.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/MongodbSinkConfig.java deleted file mode 100644 index 6df203bd6a..0000000000 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/MongodbSinkConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.connector.mongodb.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; - -@Data -public class MongodbSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 087b2e48ce..0000000000 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.connector.mongodb.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String connectorType; - - private String url; - - private String database; - - private String collection; -} diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/connector/MongodbSinkConnector.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/connector/MongodbSinkConnector.java index 814aaf2882..546204ec87 100644 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/connector/MongodbSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/connector/MongodbSinkConnector.java @@ -17,11 +17,11 @@ package org.apache.eventmesh.connector.mongodb.sink.connector; +import org.apache.eventmesh.common.config.connector.Config; import org.apache.eventmesh.connector.mongodb.sink.client.Impl.MongodbSinkClient; import org.apache.eventmesh.connector.mongodb.sink.client.MongodbReplicaSetSinkClient; import org.apache.eventmesh.connector.mongodb.sink.client.MongodbStandaloneSinkClient; -import org.apache.eventmesh.connector.mongodb.sink.config.MongodbSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.rdb.mongodb.MongodbSinkConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/client/MongodbReplicaSetSourceClient.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/client/MongodbReplicaSetSourceClient.java index 468cf6c92e..24c8f63d30 100644 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/client/MongodbReplicaSetSourceClient.java +++ b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/client/MongodbReplicaSetSourceClient.java @@ -18,7 +18,7 @@ package org.apache.eventmesh.connector.mongodb.source.client; import org.apache.eventmesh.connector.mongodb.source.client.Impl.MongodbSourceClient; -import org.apache.eventmesh.connector.mongodb.source.config.SourceConnectorConfig; +import org.apache.eventmesh.common.config.connector.rdb.mongodb.SourceConnectorConfig; import org.apache.eventmesh.connector.mongodb.utils.MongodbCloudEventUtil; import java.util.concurrent.BlockingQueue; diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/client/MongodbStandaloneSourceClient.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/client/MongodbStandaloneSourceClient.java index e062ab034d..7f557ac840 100644 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/client/MongodbStandaloneSourceClient.java +++ b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/client/MongodbStandaloneSourceClient.java @@ -20,7 +20,7 @@ import org.apache.eventmesh.common.ThreadPoolFactory; import org.apache.eventmesh.connector.mongodb.constant.MongodbConstants; import org.apache.eventmesh.connector.mongodb.source.client.Impl.MongodbSourceClient; -import org.apache.eventmesh.connector.mongodb.source.config.SourceConnectorConfig; +import org.apache.eventmesh.common.config.connector.rdb.mongodb.SourceConnectorConfig; import org.apache.eventmesh.connector.mongodb.utils.MongodbCloudEventUtil; import java.util.concurrent.BlockingQueue; diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/MongodbSourceConfig.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/MongodbSourceConfig.java deleted file mode 100644 index d67ad6c277..0000000000 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/MongodbSourceConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.connector.mongodb.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; - -@Data -public class MongodbSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/SourceConnectorConfig.java deleted file mode 100644 index 5c48645a43..0000000000 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.connector.mongodb.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String connectorType; - - private String url; - - private String database; - - private String collection; - -} diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/connector/MongodbSourceConnector.java b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/connector/MongodbSourceConnector.java index fec64de56c..35fb88d638 100644 --- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/connector/MongodbSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/connector/MongodbSourceConnector.java @@ -17,11 +17,11 @@ package org.apache.eventmesh.connector.mongodb.source.connector; +import org.apache.eventmesh.common.config.connector.Config; import org.apache.eventmesh.connector.mongodb.source.client.Impl.MongodbSourceClient; import org.apache.eventmesh.connector.mongodb.source.client.MongodbReplicaSetSourceClient; import org.apache.eventmesh.connector.mongodb.source.client.MongodbStandaloneSourceClient; -import org.apache.eventmesh.connector.mongodb.source.config.MongodbSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.rdb.mongodb.MongodbSourceConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/config/OpenFunctionServerConfig.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/config/OpenFunctionServerConfig.java index 2cf28000f5..b4ae607d5b 100644 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/config/OpenFunctionServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/config/OpenFunctionServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.openfunction.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/OpenFunctionSinkConfig.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/OpenFunctionSinkConfig.java deleted file mode 100644 index 6e4fbe3dc4..0000000000 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/OpenFunctionSinkConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.openfunction.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class OpenFunctionSinkConfig extends SinkConfig { - - public SinkConnectorConfig sinkConnectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 77c1b7c701..0000000000 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.connector.openfunction.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String target; -} diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/connector/OpenFunctionSinkConnector.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/connector/OpenFunctionSinkConnector.java index aed6936004..63444efe28 100644 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/connector/OpenFunctionSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/connector/OpenFunctionSinkConnector.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.openfunction.sink.connector; -import org.apache.eventmesh.connector.openfunction.sink.config.OpenFunctionSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.openfunction.OpenFunctionSinkConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/OpenFunctionSourceConfig.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/OpenFunctionSourceConfig.java deleted file mode 100644 index f3f5b52756..0000000000 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/OpenFunctionSourceConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.openfunction.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class OpenFunctionSourceConfig extends SourceConfig { - - public SourceConnectorConfig sourceConnectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/SourceConnectorConfig.java deleted file mode 100644 index 93fc9739fc..0000000000 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.connector.openfunction.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - -} diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/connector/OpenFunctionSourceConnector.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/connector/OpenFunctionSourceConnector.java index 916d6793db..b66bf9b18c 100644 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/connector/OpenFunctionSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/connector/OpenFunctionSourceConnector.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.openfunction.source.connector; -import org.apache.eventmesh.connector.openfunction.source.config.OpenFunctionSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.openfunction.OpenFunctionSourceConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/test/java/org/apache/eventmesh/connector/openfunction/sink/connector/OpenFunctionSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/test/java/org/apache/eventmesh/connector/openfunction/sink/connector/OpenFunctionSinkConnectorTest.java index efb25b8ea9..a2d6efdc63 100644 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/test/java/org/apache/eventmesh/connector/openfunction/sink/connector/OpenFunctionSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-openfunction/src/test/java/org/apache/eventmesh/connector/openfunction/sink/connector/OpenFunctionSinkConnectorTest.java @@ -19,10 +19,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.apache.eventmesh.connector.openfunction.sink.config.OpenFunctionSinkConfig; +import org.apache.eventmesh.common.config.connector.openfunction.OpenFunctionSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import java.util.ArrayList; import java.util.List; diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/test/java/org/apache/eventmesh/connector/openfunction/source/connector/OpenFunctionSourceConnectorTest.java b/eventmesh-connectors/eventmesh-connector-openfunction/src/test/java/org/apache/eventmesh/connector/openfunction/source/connector/OpenFunctionSourceConnectorTest.java index 2663443dbe..3aedce1a0b 100644 --- a/eventmesh-connectors/eventmesh-connector-openfunction/src/test/java/org/apache/eventmesh/connector/openfunction/source/connector/OpenFunctionSourceConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-openfunction/src/test/java/org/apache/eventmesh/connector/openfunction/source/connector/OpenFunctionSourceConnectorTest.java @@ -17,10 +17,10 @@ package org.apache.eventmesh.connector.openfunction.source.connector; -import org.apache.eventmesh.connector.openfunction.source.config.OpenFunctionSourceConfig; +import org.apache.eventmesh.common.config.connector.openfunction.OpenFunctionSourceConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import java.util.List; import java.util.concurrent.BlockingQueue; diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/config/PravegaServerConfig.java b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/config/PravegaServerConfig.java index bf5d9a4fb7..5945b4a7ae 100644 --- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/config/PravegaServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/config/PravegaServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.pravega.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/PravegaSinkConfig.java b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/PravegaSinkConfig.java deleted file mode 100644 index 739c6539b5..0000000000 --- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/PravegaSinkConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.pravega.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class PravegaSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/SinkConnectorConfig.java deleted file mode 100644 index c254dee3b8..0000000000 --- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.connector.pravega.sink.config; - -import java.net.URI; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private URI controllerURI; - - private String scope; - - private int clientPoolSize; - - private int queueSize; - - private boolean authEnabled; - - private String username; - - private String password; - - private boolean tlsEnable; - - private String truststore; -} diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/connector/PravegaSinkConnector.java b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/connector/PravegaSinkConnector.java index d1d29ad95d..e5f09e4350 100644 --- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/connector/PravegaSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/connector/PravegaSinkConnector.java @@ -17,11 +17,11 @@ package org.apache.eventmesh.connector.pravega.sink.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.pravega.PravegaSinkConfig; import org.apache.eventmesh.connector.pravega.client.PravegaCloudEventWriter; import org.apache.eventmesh.connector.pravega.client.PravegaEvent; import org.apache.eventmesh.connector.pravega.exception.PravegaConnectorException; -import org.apache.eventmesh.connector.pravega.sink.config.PravegaSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/PravegaSourceConfig.java b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/PravegaSourceConfig.java deleted file mode 100644 index 87fbd3d573..0000000000 --- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/PravegaSourceConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.pravega.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class PravegaSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/SourceConnectorConfig.java deleted file mode 100644 index 1ff54d1c1c..0000000000 --- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.connector.pravega.source.config; - -import java.net.URI; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private URI controllerURI; - - private String scope; - - private int clientPoolSize; - - private int queueSize; - - private boolean authEnabled; - - private String username; - - private String password; - - private boolean tlsEnable; - - private String truststore; - -} diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/connector/PravegaSourceConnector.java b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/connector/PravegaSourceConnector.java index c72c38f71d..2611617d8f 100644 --- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/connector/PravegaSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/connector/PravegaSourceConnector.java @@ -18,9 +18,9 @@ package org.apache.eventmesh.connector.pravega.source.connector; import org.apache.eventmesh.common.ThreadPoolFactory; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.pravega.PravegaSourceConfig; import org.apache.eventmesh.connector.pravega.client.PravegaEvent; -import org.apache.eventmesh.connector.pravega.source.config.PravegaSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; diff --git a/eventmesh-connectors/eventmesh-connector-prometheus/build.gradle b/eventmesh-connectors/eventmesh-connector-prometheus/build.gradle index 9650575803..97e4ed12f3 100644 --- a/eventmesh-connectors/eventmesh-connector-prometheus/build.gradle +++ b/eventmesh-connectors/eventmesh-connector-prometheus/build.gradle @@ -16,6 +16,7 @@ */ dependencies { + implementation project(":eventmesh-common") implementation project(":eventmesh-openconnect:eventmesh-openconnect-java") implementation 'org.apache.httpcomponents:httpclient' implementation 'com.github.rholder:guava-retrying' diff --git a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/config/PrometheusServerConfig.java b/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/config/PrometheusServerConfig.java index 3222e28210..a238109c72 100644 --- a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/config/PrometheusServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/config/PrometheusServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.prometheus.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/PrometheusSourceConfig.java b/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/PrometheusSourceConfig.java deleted file mode 100644 index 292b7e62f1..0000000000 --- a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/PrometheusSourceConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.prometheus.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class PrometheusSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/SourceConnectorConfig.java deleted file mode 100644 index 7e8b7ba93e..0000000000 --- a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.connector.prometheus.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String connectorId; - - private String address; - - private String api; - - private Long initTime; - - private String query; - - private Integer interval; - - private String step; -} \ No newline at end of file diff --git a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/connector/PrometheusSourceConnector.java b/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/connector/PrometheusSourceConnector.java index 2c75f394fc..70eb60cee2 100644 --- a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/connector/PrometheusSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/connector/PrometheusSourceConnector.java @@ -17,16 +17,16 @@ package org.apache.eventmesh.connector.prometheus.source.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.prometheus.PrometheusSourceConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.connector.prometheus.model.QueryPrometheusReq; import org.apache.eventmesh.connector.prometheus.model.QueryPrometheusRsp; -import org.apache.eventmesh.connector.prometheus.source.config.PrometheusSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.http.HttpStatus; import org.apache.http.client.methods.CloseableHttpResponse; diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/build.gradle b/eventmesh-connectors/eventmesh-connector-pulsar/build.gradle index 4a532ec2b8..904eada400 100644 --- a/eventmesh-connectors/eventmesh-connector-pulsar/build.gradle +++ b/eventmesh-connectors/eventmesh-connector-pulsar/build.gradle @@ -19,6 +19,7 @@ List pulsar = [ "org.apache.pulsar:pulsar-client:$pulsar_version" ] dependencies { + implementation project(":eventmesh-common") implementation project(":eventmesh-openconnect:eventmesh-openconnect-java") implementation pulsar compileOnly 'org.projectlombok:lombok' diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/config/PulsarServerConfig.java b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/config/PulsarServerConfig.java index 56d0b04fed..2c7e939259 100644 --- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/config/PulsarServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/config/PulsarServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.pulsar.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/PulsarSinkConfig.java b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/PulsarSinkConfig.java deleted file mode 100644 index 8d7bfe384b..0000000000 --- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/PulsarSinkConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.connector.pulsar.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; - -@Data -public class PulsarSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/SinkConnectorConfig.java deleted file mode 100644 index e1ebba09cb..0000000000 --- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.pulsar.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String serviceUrl; - - private String topic; -} diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/connector/PulsarSinkConnector.java b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/connector/PulsarSinkConnector.java index 5ea0a0147a..9ff1f22a29 100644 --- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/connector/PulsarSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/connector/PulsarSinkConnector.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.pulsar.sink.connector; -import org.apache.eventmesh.connector.pulsar.sink.config.PulsarSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.mq.pulsar.PulsarSinkConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/PulsarSourceConfig.java b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/PulsarSourceConfig.java deleted file mode 100644 index a80c2a0e50..0000000000 --- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/PulsarSourceConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.connector.pulsar.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; - -@Data -public class PulsarSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/SourceConnectorConfig.java deleted file mode 100644 index bb8ff46875..0000000000 --- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.pulsar.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String serviceUrl; - - private String topic; -} diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/connector/PulsarSourceConnector.java b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/connector/PulsarSourceConnector.java index 718dfc7357..df67e8da88 100644 --- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/connector/PulsarSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/connector/PulsarSourceConnector.java @@ -17,13 +17,13 @@ package org.apache.eventmesh.connector.pulsar.source.connector; -import org.apache.eventmesh.connector.pulsar.source.config.PulsarSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.mq.pulsar.PulsarSourceConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.pulsar.PulsarRecordPartition; import org.apache.pulsar.client.api.Consumer; import org.apache.pulsar.client.api.Message; @@ -33,9 +33,7 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import lombok.extern.slf4j.Slf4j; @@ -108,10 +106,10 @@ public List poll() { Message message = (Message) msg; byte[] body = message.getData(); String bodyStr = new String(body, StandardCharsets.UTF_8); - Map map = new HashMap<>(); - map.put("topic", consumer.getTopic()); - map.put("queueId", String.valueOf(message.getSequenceId())); - RecordPartition partition = new RecordPartition(map); + PulsarRecordPartition partition = new PulsarRecordPartition(); + partition.setTopic(consumer.getTopic()); + partition.setQueueId(message.getSequenceId()); + partition.setClazz(partition.getRecordPartitionClass()); ConnectRecord connectRecord = new ConnectRecord(partition, null, timestamp, bodyStr); connectRecord.addExtension("topic", consumer.getTopic()); connectRecords.add(connectRecord); diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/config/RabbitMQServerConfig.java b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/config/RabbitMQServerConfig.java index 9b33ce0c83..27b89c62e5 100644 --- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/config/RabbitMQServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/config/RabbitMQServerConfig.java @@ -17,10 +17,14 @@ package org.apache.eventmesh.connector.rabbitmq.config; +import org.apache.eventmesh.common.config.connector.Config; + import lombok.Data; +import lombok.EqualsAndHashCode; @Data -public class RabbitMQServerConfig { +@EqualsAndHashCode(callSuper = true) +public class RabbitMQServerConfig extends Config { private boolean sourceEnable; diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/RabbitMQSinkConfig.java b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/RabbitMQSinkConfig.java deleted file mode 100644 index 1c4ec66d47..0000000000 --- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/RabbitMQSinkConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.rabbitmq.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class RabbitMQSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 358964bdc0..0000000000 --- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.connector.rabbitmq.sink.config; - -import com.rabbitmq.client.BuiltinExchangeType; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String host; - - private int port; - - private String username; - - private String passwd; - - private String virtualHost; - - private BuiltinExchangeType exchangeType; - - private String exchangeName; - - private String routingKey; - - private String queueName; - - private boolean autoAck; -} diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/connector/RabbitMQSinkConnector.java b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/connector/RabbitMQSinkConnector.java index 250f31c5bb..4a94a2cb1f 100644 --- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/connector/RabbitMQSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/connector/RabbitMQSinkConnector.java @@ -17,12 +17,12 @@ package org.apache.eventmesh.connector.rabbitmq.sink.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.mq.rabbitmq.RabbitMQSinkConfig; import org.apache.eventmesh.connector.rabbitmq.client.RabbitmqClient; import org.apache.eventmesh.connector.rabbitmq.client.RabbitmqConnectionFactory; import org.apache.eventmesh.connector.rabbitmq.cloudevent.RabbitmqCloudEvent; import org.apache.eventmesh.connector.rabbitmq.cloudevent.RabbitmqCloudEventWriter; -import org.apache.eventmesh.connector.rabbitmq.sink.config.RabbitMQSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; @@ -33,6 +33,7 @@ import io.cloudevents.CloudEvent; +import com.rabbitmq.client.BuiltinExchangeType; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; @@ -77,7 +78,8 @@ public void init(ConnectorContext connectorContext) throws Exception { @Override public void start() throws Exception { if (!started) { - rabbitmqClient.binding(channel, sinkConfig.getConnectorConfig().getExchangeType(), sinkConfig.getConnectorConfig().getExchangeName(), + BuiltinExchangeType builtinExchangeType = BuiltinExchangeType.valueOf(sinkConfig.getConnectorConfig().getExchangeType()); + rabbitmqClient.binding(channel, builtinExchangeType, sinkConfig.getConnectorConfig().getExchangeName(), sinkConfig.getConnectorConfig().getRoutingKey(), sinkConfig.getConnectorConfig().getQueueName()); started = true; } diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/RabbitMQSourceConfig.java b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/RabbitMQSourceConfig.java deleted file mode 100644 index 55ce402ae7..0000000000 --- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/RabbitMQSourceConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.rabbitmq.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class RabbitMQSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/SourceConnectorConfig.java deleted file mode 100644 index d83149f9ca..0000000000 --- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.connector.rabbitmq.source.config; - -import com.rabbitmq.client.BuiltinExchangeType; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String host; - - private int port; - - private String username; - - private String passwd; - - private String virtualHost; - - private BuiltinExchangeType exchangeType; - - private String exchangeName; - - private String routingKey; - - private String queueName; - - private boolean autoAck; -} diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/connector/RabbitMQSourceConnector.java b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/connector/RabbitMQSourceConnector.java index 95b09034ef..655c20d9b9 100644 --- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/connector/RabbitMQSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/connector/RabbitMQSourceConnector.java @@ -18,12 +18,12 @@ package org.apache.eventmesh.connector.rabbitmq.source.connector; import org.apache.eventmesh.common.ThreadPoolFactory; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.mq.rabbitmq.RabbitMQSourceConfig; +import org.apache.eventmesh.common.config.connector.mq.rabbitmq.SourceConnectorConfig; import org.apache.eventmesh.connector.rabbitmq.client.RabbitmqClient; import org.apache.eventmesh.connector.rabbitmq.client.RabbitmqConnectionFactory; import org.apache.eventmesh.connector.rabbitmq.cloudevent.RabbitmqCloudEvent; -import org.apache.eventmesh.connector.rabbitmq.source.config.RabbitMQSourceConfig; -import org.apache.eventmesh.connector.rabbitmq.source.config.SourceConnectorConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; @@ -40,6 +40,7 @@ import io.cloudevents.CloudEvent; +import com.rabbitmq.client.BuiltinExchangeType; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.GetResponse; @@ -98,7 +99,8 @@ public void init(ConnectorContext connectorContext) throws Exception { @Override public void start() throws Exception { if (!started) { - rabbitmqClient.binding(channel, sourceConfig.getConnectorConfig().getExchangeType(), sourceConfig.getConnectorConfig().getExchangeName(), + BuiltinExchangeType builtinExchangeType = BuiltinExchangeType.valueOf(sourceConfig.getConnectorConfig().getExchangeType()); + rabbitmqClient.binding(channel, builtinExchangeType, sourceConfig.getConnectorConfig().getExchangeName(), sourceConfig.getConnectorConfig().getRoutingKey(), sourceConfig.getConnectorConfig().getQueueName()); executor.execute(this.rabbitMQSourceHandler); started = true; diff --git a/eventmesh-connectors/eventmesh-connector-redis/build.gradle b/eventmesh-connectors/eventmesh-connector-redis/build.gradle index 425a10570a..3cf01f264e 100644 --- a/eventmesh-connectors/eventmesh-connector-redis/build.gradle +++ b/eventmesh-connectors/eventmesh-connector-redis/build.gradle @@ -16,6 +16,7 @@ */ dependencies { + implementation project(":eventmesh-common") implementation project(":eventmesh-openconnect:eventmesh-openconnect-java") implementation 'org.redisson:redisson:3.17.3' diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/config/RedisServerConfig.java b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/config/RedisServerConfig.java index 6b55b0e6e9..d4aaee292a 100644 --- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/config/RedisServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/config/RedisServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.redis.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/RedisSinkConfig.java b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/RedisSinkConfig.java deleted file mode 100644 index 62cddbf312..0000000000 --- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/RedisSinkConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.connector.redis.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; - -@Data -public class RedisSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 34fb0326a4..0000000000 --- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.redis.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String server; - - private String topic; -} diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/connector/RedisSinkConnector.java b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/connector/RedisSinkConnector.java index e07e05e276..83c3498a99 100644 --- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/connector/RedisSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/connector/RedisSinkConnector.java @@ -17,9 +17,9 @@ package org.apache.eventmesh.connector.redis.sink.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.redis.RedisSinkConfig; import org.apache.eventmesh.connector.redis.cloudevent.CloudEventCodec; -import org.apache.eventmesh.connector.redis.sink.config.RedisSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/RedisSourceConfig.java b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/RedisSourceConfig.java deleted file mode 100644 index f01a556c9f..0000000000 --- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/RedisSourceConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.connector.redis.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; - -@Data -public class RedisSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/SourceConnectorConfig.java deleted file mode 100644 index 9913e16320..0000000000 --- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.redis.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String server; - - private String topic; - -} diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/connector/RedisSourceConnector.java b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/connector/RedisSourceConnector.java index 2933d545dd..70adce59e2 100644 --- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/connector/RedisSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/connector/RedisSourceConnector.java @@ -17,9 +17,9 @@ package org.apache.eventmesh.connector.redis.source.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.redis.RedisSourceConfig; import org.apache.eventmesh.connector.redis.cloudevent.CloudEventCodec; -import org.apache.eventmesh.connector.redis.source.config.RedisSourceConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/test/java/org/apache/eventmesh/connector/redis/sink/connector/RedisSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-redis/src/test/java/org/apache/eventmesh/connector/redis/sink/connector/RedisSinkConnectorTest.java index 13ec4f7379..da5e43a070 100644 --- a/eventmesh-connectors/eventmesh-connector-redis/src/test/java/org/apache/eventmesh/connector/redis/sink/connector/RedisSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-redis/src/test/java/org/apache/eventmesh/connector/redis/sink/connector/RedisSinkConnectorTest.java @@ -17,12 +17,12 @@ package org.apache.eventmesh.connector.redis.sink.connector; +import org.apache.eventmesh.common.config.connector.redis.RedisSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.connector.redis.AbstractRedisServer; import org.apache.eventmesh.connector.redis.cloudevent.CloudEventCodec; -import org.apache.eventmesh.connector.redis.sink.config.RedisSinkConfig; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.ConfigUtil; import java.nio.charset.StandardCharsets; diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/test/java/org/apache/eventmesh/connector/redis/source/connector/RedisSourceConnectorTest.java b/eventmesh-connectors/eventmesh-connector-redis/src/test/java/org/apache/eventmesh/connector/redis/source/connector/RedisSourceConnectorTest.java index da68a5b170..9088043567 100644 --- a/eventmesh-connectors/eventmesh-connector-redis/src/test/java/org/apache/eventmesh/connector/redis/source/connector/RedisSourceConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-redis/src/test/java/org/apache/eventmesh/connector/redis/source/connector/RedisSourceConnectorTest.java @@ -17,12 +17,12 @@ package org.apache.eventmesh.connector.redis.source.connector; +import org.apache.eventmesh.common.config.connector.redis.RedisSourceConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.connector.redis.AbstractRedisServer; import org.apache.eventmesh.connector.redis.cloudevent.CloudEventCodec; -import org.apache.eventmesh.connector.redis.source.config.RedisSourceConfig; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.CloudEventUtil; import org.apache.eventmesh.openconnect.util.ConfigUtil; diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/config/RocketMQServerConfig.java b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/config/RocketMQServerConfig.java index 4dc574cda2..842094e07f 100644 --- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/config/RocketMQServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/config/RocketMQServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.rocketmq.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/RocketMQSinkConfig.java b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/RocketMQSinkConfig.java deleted file mode 100644 index bc4191c9bf..0000000000 --- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/RocketMQSinkConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.rocketmq.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class RocketMQSinkConfig extends SinkConfig { - - public SinkConnectorConfig connectorConfig; - -} diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 034dd7ce0c..0000000000 --- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.rocketmq.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String nameServer; - - private String topic; -} diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/connector/RocketMQSinkConnector.java b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/connector/RocketMQSinkConnector.java index 9eb23f9318..ae9d4824e5 100644 --- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/connector/RocketMQSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/connector/RocketMQSinkConnector.java @@ -17,9 +17,9 @@ package org.apache.eventmesh.connector.rocketmq.sink.connector; -import org.apache.eventmesh.connector.rocketmq.sink.config.RocketMQSinkConfig; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.mq.rocketmq.RocketMQSinkConfig; import org.apache.eventmesh.openconnect.api.ConnectorCreateService; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/RocketMQSourceConfig.java b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/RocketMQSourceConfig.java deleted file mode 100644 index 43a74fabd4..0000000000 --- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/RocketMQSourceConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.rocketmq.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class RocketMQSourceConfig extends SourceConfig { - - public SourceConnectorConfig connectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/SourceConnectorConfig.java deleted file mode 100644 index 1dc8a0d5c9..0000000000 --- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.connector.rocketmq.source.config; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String nameserver; - - private String topic; - - private long commitOffsetIntervalMs = 5 * 1000; -} diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/connector/RocketMQSourceConnector.java b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/connector/RocketMQSourceConnector.java index ab2bcd92a7..0b0250c199 100644 --- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/connector/RocketMQSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/connector/RocketMQSourceConnector.java @@ -17,15 +17,17 @@ package org.apache.eventmesh.connector.rocketmq.source.connector; -import org.apache.eventmesh.connector.rocketmq.source.config.RocketMQSourceConfig; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.mq.rocketmq.RocketMQSourceConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.api.ConnectorCreateService; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.rocketmq.RocketMQRecordOffset; +import org.apache.eventmesh.common.remote.offset.rocketmq.RocketMQRecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.OffsetStorageReader; import org.apache.rocketmq.client.consumer.AllocateMessageQueueStrategy; @@ -78,7 +80,7 @@ public class RocketMQSourceConnector implements Source, ConnectorCreateService> prepareCommitOffset = new ConcurrentHashMap<>(); - private ConcurrentHashMap> queue2Offsets = new ConcurrentHashMap<>(); + private final ConcurrentHashMap> queue2Offsets = new ConcurrentHashMap<>(); private final AtomicInteger unAckCounter = new AtomicInteger(); @@ -142,15 +144,18 @@ public void start() throws Exception { for (MessageQueue messageQueue : mqDivided) { try { - Map partitionMap = new HashMap<>(); - partitionMap.put("topic", messageQueue.getTopic()); - partitionMap.put("brokerName", messageQueue.getBrokerName()); - partitionMap.put("queueId", messageQueue.getQueueId() + ""); - RecordPartition recordPartition = new RecordPartition(partitionMap); +// Map partitionMap = new HashMap<>(); +// partitionMap.put("topic", messageQueue.getTopic()); +// partitionMap.put("brokerName", messageQueue.getBrokerName()); +// partitionMap.put("queueId", messageQueue.getQueueId() + ""); + RocketMQRecordPartition recordPartition = new RocketMQRecordPartition(); + recordPartition.setBroker(messageQueue.getBrokerName()); + recordPartition.setTopic(messageQueue.getTopic()); + recordPartition.setQueueId(messageQueue.getQueueId() + ""); RecordOffset recordOffset = offsetStorageReader.readOffset(recordPartition); log.info("assigned messageQueue {}, recordOffset {}", messageQueue, recordOffset); if (recordOffset != null) { - long pollOffset = (Long) recordOffset.getOffset().get("queueOffset"); + long pollOffset = ((RocketMQRecordOffset) recordOffset).getQueueOffset(); if (pollOffset != 0) { consumer.seek(messageQueue, pollOffset); } @@ -187,13 +192,13 @@ private List getMessageQueueList(String topic) throws MQClientExce @Override public void commit(ConnectRecord record) { // send success, commit offset - Map map = record.getPosition().getPartition().getPartition(); - String brokerName = (String) map.get("brokerName"); - String topic = (String) map.get("topic"); - int queueId = Integer.parseInt((String) map.get("queueId")); + RocketMQRecordPartition rocketMQRecordPartition = (RocketMQRecordPartition)(record.getPosition().getRecordPartition()); + String brokerName = rocketMQRecordPartition.getBroker(); + String topic = rocketMQRecordPartition.getTopic(); + int queueId = Integer.parseInt(rocketMQRecordPartition.getQueueId()); MessageQueue mq = new MessageQueue(topic, brokerName, queueId); - Map offsetMap = record.getPosition().getOffset().getOffset(); - long offset = Long.parseLong((String) offsetMap.get("queueOffset")); + RocketMQRecordOffset rocketMQRecordOffset = (RocketMQRecordOffset)record.getPosition().getRecordOffset(); + long offset = rocketMQRecordOffset.getQueueOffset(); long canCommitOffset = removeMessage(mq, offset); log.info("commit record {}|mq {}|canCommitOffset {}", record, mq, canCommitOffset); // commit offset to prepareCommitOffset @@ -233,17 +238,18 @@ public List poll() { } public static RecordOffset convertToRecordOffset(Long offset) { - Map offsetMap = new HashMap<>(); - offsetMap.put("queueOffset", offset + ""); - return new RecordOffset(offsetMap); + RocketMQRecordOffset rocketMQRecordOffset = new RocketMQRecordOffset(); + rocketMQRecordOffset.setQueueOffset(offset); + return rocketMQRecordOffset; } public static RecordPartition convertToRecordPartition(String topic, String brokerName, int queueId) { - Map map = new HashMap<>(); - map.put("topic", topic); - map.put("brokerName", brokerName); - map.put("queueId", queueId + ""); - return new RecordPartition(map); + RocketMQRecordPartition rocketMQRecordPartition = new RocketMQRecordPartition(); + rocketMQRecordPartition.setBroker(brokerName); + rocketMQRecordPartition.setTopic(topic); + rocketMQRecordPartition.setQueueId(queueId + ""); + + return rocketMQRecordPartition; } private void putPulledQueueOffset(MessageExt messageExt) { diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/test/java/org/apache/eventmesh/connector/rocketmq/sink/connector/RocketMQSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-rocketmq/src/test/java/org/apache/eventmesh/connector/rocketmq/sink/connector/RocketMQSinkConnectorTest.java index afd13a3f2f..917c8c0391 100644 --- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/test/java/org/apache/eventmesh/connector/rocketmq/sink/connector/RocketMQSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-rocketmq/src/test/java/org/apache/eventmesh/connector/rocketmq/sink/connector/RocketMQSinkConnectorTest.java @@ -21,10 +21,10 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import org.apache.eventmesh.connector.rocketmq.sink.config.RocketMQSinkConfig; +import org.apache.eventmesh.common.config.connector.mq.rocketmq.RocketMQSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.ConfigUtil; import org.apache.rocketmq.client.producer.DefaultMQProducer; diff --git a/eventmesh-connectors/eventmesh-connector-s3/build.gradle b/eventmesh-connectors/eventmesh-connector-s3/build.gradle index 9d004b2f15..af2867917e 100644 --- a/eventmesh-connectors/eventmesh-connector-s3/build.gradle +++ b/eventmesh-connectors/eventmesh-connector-s3/build.gradle @@ -16,6 +16,7 @@ */ dependencies { + implementation project(":eventmesh-common") implementation project(":eventmesh-openconnect:eventmesh-openconnect-java") implementation 'software.amazon.awssdk:s3' compileOnly 'org.projectlombok:lombok' diff --git a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/config/S3ServerConfig.java b/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/config/S3ServerConfig.java index f5c4371d4c..a422c0468c 100644 --- a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/config/S3ServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/config/S3ServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.s3.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/S3SourceConfig.java b/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/S3SourceConfig.java deleted file mode 100644 index 0f4bec5d56..0000000000 --- a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/S3SourceConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.connector.s3.source.config; - -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; - -@Data -public class S3SourceConfig extends SourceConfig { - - private SourceConnectorConfig sourceConnectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/SourceConnectorConfig.java deleted file mode 100644 index 2c9cb5a80c..0000000000 --- a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/SourceConnectorConfig.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.connector.s3.source.config; - -import java.util.Map; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - - private String region; - - private String bucket; - - private String accessKey; - - private String secretKey; - - private String fileName; - - /** - * The schema for the data to be read from S3. - */ - private Map schema; - - /** - * The maximum number of records that should be returned in each batch poll. - */ - private Integer batchSize = 20; - - /** - * The maximum ms to wait for request futures to complete. - */ - private long timeout = 3000; -} diff --git a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/connector/S3SourceConnector.java b/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/connector/S3SourceConnector.java index 83ac15398b..ae86778b60 100644 --- a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/connector/S3SourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/connector/S3SourceConnector.java @@ -17,21 +17,21 @@ package org.apache.eventmesh.connector.s3.source.connector; -import org.apache.eventmesh.connector.s3.source.config.S3SourceConfig; -import org.apache.eventmesh.connector.s3.source.config.SourceConnectorConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.s3.S3SourceConfig; +import org.apache.eventmesh.common.config.connector.s3.SourceConnectorConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.S3.S3RecordOffset; +import org.apache.eventmesh.common.remote.offset.S3.S3RecordPartition; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; @@ -157,16 +157,18 @@ public List poll() { } private RecordPartition getRecordPartition() { - Map map = new HashMap<>(); - map.put(REGION, this.sourceConnectorConfig.getRegion()); - map.put(BUCKET, this.sourceConnectorConfig.getBucket()); - map.put(FILE_NAME, this.sourceConnectorConfig.getFileName()); - return new RecordPartition(map); + S3RecordPartition s3RecordPartition = new S3RecordPartition(); + s3RecordPartition.setRegion(this.sourceConnectorConfig.getRegion()); + s3RecordPartition.setBucket(this.sourceConnectorConfig.getBucket()); + s3RecordPartition.setFileName(this.sourceConnectorConfig.getFileName()); + s3RecordPartition.setClazz(s3RecordPartition.getRecordPartitionClass()); + return s3RecordPartition; } private RecordOffset getRecordOffset() { - Map map = new HashMap<>(); - map.put(POSITION, String.valueOf(this.position)); - return new RecordOffset(map); + S3RecordOffset s3RecordOffset = new S3RecordOffset(); + s3RecordOffset.setOffset(this.position); + s3RecordOffset.setClazz(s3RecordOffset.getRecordOffsetClass()); + return s3RecordOffset; } } diff --git a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/config/SlackConnectServerConfig.java b/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/config/SlackConnectServerConfig.java index 515c5af6c7..97479cb87a 100644 --- a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/config/SlackConnectServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/config/SlackConnectServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.slack.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 41884a94a1..0000000000 --- a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.slack.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String appToken; - - private String channelId; -} diff --git a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SlackSinkConfig.java b/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SlackSinkConfig.java deleted file mode 100644 index 016cd9ae97..0000000000 --- a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SlackSinkConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.slack.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class SlackSinkConfig extends SinkConfig { - - private SinkConnectorConfig sinkConnectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/connector/SlackSinkConnector.java b/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/connector/SlackSinkConnector.java index a026f2aa22..e48760d506 100644 --- a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/connector/SlackSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/connector/SlackSinkConnector.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.slack.sink.connector; -import org.apache.eventmesh.connector.slack.sink.config.SlackSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.slack.SlackSinkConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-slack/src/test/java/org/apache/eventmesh/connector/slack/sink/connector/SlackSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-slack/src/test/java/org/apache/eventmesh/connector/slack/sink/connector/SlackSinkConnectorTest.java index 3f0a32755f..6174c7dc18 100644 --- a/eventmesh-connectors/eventmesh-connector-slack/src/test/java/org/apache/eventmesh/connector/slack/sink/connector/SlackSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-slack/src/test/java/org/apache/eventmesh/connector/slack/sink/connector/SlackSinkConnectorTest.java @@ -22,10 +22,10 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import org.apache.eventmesh.connector.slack.sink.config.SlackSinkConfig; +import org.apache.eventmesh.common.config.connector.slack.SlackSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.ConfigUtil; import java.lang.reflect.Field; diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/config/SpringConnectServerConfig.java b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/config/SpringConnectServerConfig.java index 7eb2009fbd..88cf8156a8 100644 --- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/config/SpringConnectServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/config/SpringConnectServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.spring.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/config/SpringSinkConfig.java b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/config/SpringSinkConfig.java deleted file mode 100644 index aff0d8a0f3..0000000000 --- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/config/SpringSinkConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.spring.sink.config; - -import org.apache.eventmesh.connector.spring.sink.connector.SinkConnectorConfig; -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class SpringSinkConfig extends SinkConfig { - - private SinkConnectorConfig sinkConnectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SinkConnectorConfig.java deleted file mode 100644 index a71c4ab66c..0000000000 --- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SinkConnectorConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.connector.spring.sink.connector; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - -} diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SpringSinkConnector.java b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SpringSinkConnector.java index 648e1f8071..94c40eea50 100644 --- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SpringSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SpringSinkConnector.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.connector.spring.sink.connector; -import org.apache.eventmesh.connector.spring.sink.config.SpringSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.spring.SpringSinkConfig; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/config/SpringSourceConfig.java b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/config/SpringSourceConfig.java deleted file mode 100644 index 191e9b1196..0000000000 --- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/config/SpringSourceConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.connector.spring.source.config; - -import org.apache.eventmesh.connector.spring.source.connector.SourceConnectorConfig; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class SpringSourceConfig extends SourceConfig { - - private SourceConnectorConfig sourceConnectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SourceConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SourceConnectorConfig.java deleted file mode 100644 index 242869087f..0000000000 --- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SourceConnectorConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.connector.spring.source.connector; - -import lombok.Data; - -@Data -public class SourceConnectorConfig { - - private String connectorName; - -} diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SpringSourceConnector.java b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SpringSourceConnector.java index 5f4d5c89b7..d5317b530a 100644 --- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SpringSourceConnector.java +++ b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SpringSourceConnector.java @@ -17,17 +17,17 @@ package org.apache.eventmesh.connector.spring.source.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.spring.SpringSourceConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.connector.spring.source.MessageSendingOperations; -import org.apache.eventmesh.connector.spring.source.config.SpringSourceConfig; import org.apache.eventmesh.openconnect.SourceWorker; import org.apache.eventmesh.openconnect.api.callback.SendMessageCallback; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import java.util.ArrayList; import java.util.List; diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/test/java/org/apache/eventmesh/connector/spring/sink/connector/SpringSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-spring/src/test/java/org/apache/eventmesh/connector/spring/sink/connector/SpringSinkConnectorTest.java index ea0ea7c359..d237c34e50 100644 --- a/eventmesh-connectors/eventmesh-connector-spring/src/test/java/org/apache/eventmesh/connector/spring/sink/connector/SpringSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-spring/src/test/java/org/apache/eventmesh/connector/spring/sink/connector/SpringSinkConnectorTest.java @@ -19,10 +19,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.apache.eventmesh.connector.spring.sink.config.SpringSinkConfig; +import org.apache.eventmesh.common.config.connector.spring.SpringSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import java.util.ArrayList; import java.util.List; diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/test/java/org/apache/eventmesh/connector/spring/source/connector/SpringSourceConnectorTest.java b/eventmesh-connectors/eventmesh-connector-spring/src/test/java/org/apache/eventmesh/connector/spring/source/connector/SpringSourceConnectorTest.java index 65c71aea09..c4c59f0e5f 100644 --- a/eventmesh-connectors/eventmesh-connector-spring/src/test/java/org/apache/eventmesh/connector/spring/source/connector/SpringSourceConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-spring/src/test/java/org/apache/eventmesh/connector/spring/source/connector/SpringSourceConnectorTest.java @@ -19,7 +19,7 @@ import static org.mockito.Mockito.doReturn; -import org.apache.eventmesh.connector.spring.source.config.SpringSourceConfig; +import org.apache.eventmesh.common.config.connector.spring.SpringSourceConfig; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; import java.util.List; diff --git a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/config/WeChatConnectServerConfig.java b/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/config/WeChatConnectServerConfig.java index a2634b6b49..2555041c02 100644 --- a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/config/WeChatConnectServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/config/WeChatConnectServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.wechat.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/SinkConnectorConfig.java deleted file mode 100644 index e575e65c67..0000000000 --- a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.wechat.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String appId; - - private String appSecret; -} diff --git a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/WeChatSinkConfig.java b/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/WeChatSinkConfig.java deleted file mode 100644 index a77e1c77b5..0000000000 --- a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/WeChatSinkConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.wechat.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class WeChatSinkConfig extends SinkConfig { - - private SinkConnectorConfig sinkConnectorConfig; -} \ No newline at end of file diff --git a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/connector/WeChatSinkConnector.java b/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/connector/WeChatSinkConnector.java index ac66ec45cc..dec3f5e5de 100644 --- a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/connector/WeChatSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/connector/WeChatSinkConnector.java @@ -17,9 +17,9 @@ package org.apache.eventmesh.connector.wechat.sink.connector; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.wechat.WeChatSinkConfig; import org.apache.eventmesh.common.utils.JsonUtils; -import org.apache.eventmesh.connector.wechat.sink.config.WeChatSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-wechat/src/test/java/org/apache/eventmesh/connector/wechat/sink/connector/WeChatSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-wechat/src/test/java/org/apache/eventmesh/connector/wechat/sink/connector/WeChatSinkConnectorTest.java index d993468c18..1bea7de490 100644 --- a/eventmesh-connectors/eventmesh-connector-wechat/src/test/java/org/apache/eventmesh/connector/wechat/sink/connector/WeChatSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-wechat/src/test/java/org/apache/eventmesh/connector/wechat/sink/connector/WeChatSinkConnectorTest.java @@ -21,10 +21,10 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import org.apache.eventmesh.connector.wechat.sink.config.WeChatSinkConfig; +import org.apache.eventmesh.common.config.connector.wechat.WeChatSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.ConfigUtil; import java.io.IOException; diff --git a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/config/WeComConnectServerConfig.java b/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/config/WeComConnectServerConfig.java index 1f864726bf..38235b3d3b 100644 --- a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/config/WeComConnectServerConfig.java +++ b/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/config/WeComConnectServerConfig.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.connector.wecom.config; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/SinkConnectorConfig.java deleted file mode 100644 index 013d5a8bb7..0000000000 --- a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/SinkConnectorConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.connector.wecom.sink.config; - -import lombok.Data; - -@Data -public class SinkConnectorConfig { - - private String connectorName; - - private String robotWebhookKey; - -} diff --git a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/WeComSinkConfig.java b/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/WeComSinkConfig.java deleted file mode 100644 index 8af43bdbe8..0000000000 --- a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/WeComSinkConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.connector.wecom.sink.config; - -import org.apache.eventmesh.openconnect.api.config.SinkConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class WeComSinkConfig extends SinkConfig { - - private SinkConnectorConfig sinkConnectorConfig; -} diff --git a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/connector/WeComSinkConnector.java b/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/connector/WeComSinkConnector.java index 499104e11a..ef6aed58c5 100644 --- a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/connector/WeComSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/connector/WeComSinkConnector.java @@ -18,12 +18,12 @@ package org.apache.eventmesh.connector.wecom.sink.connector; import org.apache.eventmesh.common.Constants; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.wecom.WeComSinkConfig; import org.apache.eventmesh.common.enums.EventMeshDataContentType; import org.apache.eventmesh.common.utils.JsonUtils; import org.apache.eventmesh.connector.wecom.config.WeComMessageTemplateType; import org.apache.eventmesh.connector.wecom.constants.ConnectRecordExtensionKeys; -import org.apache.eventmesh.connector.wecom.sink.config.WeComSinkConfig; -import org.apache.eventmesh.openconnect.api.config.Config; import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; diff --git a/eventmesh-connectors/eventmesh-connector-wecom/src/test/java/org/apache/eventmesh/connector/wecom/connector/WeComSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-wecom/src/test/java/org/apache/eventmesh/connector/wecom/connector/WeComSinkConnectorTest.java index 4cf9f3523b..e78e089035 100644 --- a/eventmesh-connectors/eventmesh-connector-wecom/src/test/java/org/apache/eventmesh/connector/wecom/connector/WeComSinkConnectorTest.java +++ b/eventmesh-connectors/eventmesh-connector-wecom/src/test/java/org/apache/eventmesh/connector/wecom/connector/WeComSinkConnectorTest.java @@ -17,34 +17,21 @@ package org.apache.eventmesh.connector.wecom.connector; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - +import org.apache.eventmesh.common.config.connector.wecom.WeComSinkConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.common.utils.JsonUtils; import org.apache.eventmesh.connector.wecom.config.WeComMessageTemplateType; import org.apache.eventmesh.connector.wecom.constants.ConnectRecordExtensionKeys; -import org.apache.eventmesh.connector.wecom.sink.config.WeComSinkConfig; import org.apache.eventmesh.connector.wecom.sink.connector.SendMessageResponse; import org.apache.eventmesh.connector.wecom.sink.connector.WeComSinkConnector; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; import org.apache.eventmesh.openconnect.util.ConfigUtil; - import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.util.EntityUtils; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -56,6 +43,17 @@ import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; +import java.io.IOException; +import java.lang.reflect.Field; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + @ExtendWith(MockitoExtension.class) public class WeComSinkConnectorTest { @@ -89,8 +87,8 @@ public void testSendMessageToWeCom() throws IOException { final int times = 3; List records = new ArrayList<>(); for (int i = 0; i < times; i++) { - RecordPartition partition = new RecordPartition(); - RecordOffset offset = new RecordOffset(); + RecordPartition partition = new MockRecordPartition(); + RecordOffset offset = new MockRecordOffset(); ConnectRecord connectRecord = new ConnectRecord(partition, offset, System.currentTimeMillis(), "Hello, EventMesh!".getBytes(StandardCharsets.UTF_8)); connectRecord.addExtension(ConnectRecordExtensionKeys.WECOM_MESSAGE_TEMPLATE_TYPE, diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/Application.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/Application.java index 3252a52e3e..b28f6387a9 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/Application.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/Application.java @@ -17,10 +17,10 @@ package org.apache.eventmesh.openconnect; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.SinkConfig; +import org.apache.eventmesh.common.config.connector.SourceConfig; import org.apache.eventmesh.openconnect.api.ConnectorCreateService; -import org.apache.eventmesh.openconnect.api.config.Config; -import org.apache.eventmesh.openconnect.api.config.SinkConfig; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; import org.apache.eventmesh.openconnect.api.connector.Connector; import org.apache.eventmesh.openconnect.api.sink.Sink; import org.apache.eventmesh.openconnect.api.source.Source; diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SinkWorker.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SinkWorker.java index a62b1b19ba..57ad4b8ec3 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SinkWorker.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SinkWorker.java @@ -22,11 +22,11 @@ import org.apache.eventmesh.client.tcp.common.MessageUtils; import org.apache.eventmesh.client.tcp.common.ReceiveMsgHook; import org.apache.eventmesh.client.tcp.conf.EventMeshTCPClientConfig; +import org.apache.eventmesh.common.config.connector.SinkConfig; import org.apache.eventmesh.common.protocol.SubscriptionMode; import org.apache.eventmesh.common.protocol.SubscriptionType; import org.apache.eventmesh.common.protocol.tcp.UserAgent; import org.apache.eventmesh.common.utils.SystemUtils; -import org.apache.eventmesh.openconnect.api.config.SinkConfig; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.sink.Sink; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java index 6dcbcd2994..6e48aa1de8 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java @@ -24,6 +24,8 @@ import org.apache.eventmesh.client.tcp.common.MessageUtils; import org.apache.eventmesh.client.tcp.conf.EventMeshTCPClientConfig; import org.apache.eventmesh.common.ThreadPoolFactory; +import org.apache.eventmesh.common.config.connector.SourceConfig; +import org.apache.eventmesh.common.config.connector.offset.OffsetStorageConfig; import org.apache.eventmesh.common.exception.EventMeshException; import org.apache.eventmesh.common.protocol.tcp.OPStatus; import org.apache.eventmesh.common.protocol.tcp.Package; @@ -33,10 +35,8 @@ import org.apache.eventmesh.openconnect.api.callback.SendExcepionContext; import org.apache.eventmesh.openconnect.api.callback.SendMessageCallback; import org.apache.eventmesh.openconnect.api.callback.SendResult; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.source.Source; -import org.apache.eventmesh.openconnect.offsetmgmt.api.config.OffsetStorageConfig; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffsetManagement; import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.DefaultOffsetManagementServiceImpl; @@ -152,8 +152,8 @@ public void init() { .map(storageType -> EventMeshExtensionFactory.getExtension(OffsetManagementService.class, storageType)) .orElse(new DefaultOffsetManagementServiceImpl()); this.offsetManagementService.initialize(offsetStorageConfig); - this.offsetStorageWriter = new OffsetStorageWriterImpl(source.name(), offsetManagementService); - this.offsetStorageReader = new OffsetStorageReaderImpl(source.name(), offsetManagementService); + this.offsetStorageWriter = new OffsetStorageWriterImpl(offsetManagementService); + this.offsetStorageReader = new OffsetStorageReaderImpl(offsetManagementService); } @Override diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Config.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Config.java deleted file mode 100644 index 330aa93932..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Config.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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.openconnect.api.config; - -public abstract class Config { -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Constants.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Constants.java deleted file mode 100644 index 59794e562a..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Constants.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.openconnect.api.config; - -public class Constants { - - public static final String ENV_TARGET = "connectorTarget"; - - public static final String ENV_PORT = "connectorPort"; - - public static final String ENV_SOURCE_CONFIG_FILE = "sourceConnectorConf"; - - public static final String ENV_SINK_CONFIG_FILE = "sinkConnectorConf"; - - public static final int DEFAULT_ATTEMPT = 3; - - public static final int DEFAULT_PORT = 8080; -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/PubSubConfig.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/PubSubConfig.java deleted file mode 100644 index 6f5c9cd5f4..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/PubSubConfig.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.openconnect.api.config; - -import lombok.Data; - -@Data -public class PubSubConfig { - - private String meshAddress; - - private String subject; - - private String idc; - - private String env; - - private String group; - - private String appId; - - private String userName; - - private String passWord; - -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SinkConfig.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SinkConfig.java deleted file mode 100644 index 527d02e04d..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SinkConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.openconnect.api.config; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public abstract class SinkConfig extends Config { - - private PubSubConfig pubSubConfig; - -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SourceConfig.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SourceConfig.java deleted file mode 100644 index 2942be936c..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SourceConfig.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.openconnect.api.config; - -import org.apache.eventmesh.openconnect.offsetmgmt.api.config.OffsetStorageConfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public abstract class SourceConfig extends Config { - - private PubSubConfig pubSubConfig; - - private OffsetStorageConfig offsetStorageConfig; - -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/Connector.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/Connector.java index 82993b198b..11c2b77454 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/Connector.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/Connector.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.openconnect.api.connector; -import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.common.config.connector.Config; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; /** diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SinkConnector.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SinkConnector.java index 70b62c1200..9b271746f3 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SinkConnector.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SinkConnector.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.openconnect.api.connector; -import org.apache.eventmesh.openconnect.api.config.SinkConfig; +import org.apache.eventmesh.common.config.connector.SinkConfig; import org.apache.eventmesh.openconnect.api.sink.Sink; public abstract class SinkConnector implements Sink { diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SinkConnectorContext.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SinkConnectorContext.java index a7aef4fff2..cf1b853474 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SinkConnectorContext.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SinkConnectorContext.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.openconnect.api.connector; -import org.apache.eventmesh.openconnect.api.config.SinkConfig; +import org.apache.eventmesh.common.config.connector.SinkConfig; import lombok.Data; diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SourceConnector.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SourceConnector.java index 100612662d..95279c2d41 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SourceConnector.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SourceConnector.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.openconnect.api.connector; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; +import org.apache.eventmesh.common.config.connector.SourceConfig; import org.apache.eventmesh.openconnect.api.source.Source; public abstract class SourceConnector implements Source { diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SourceConnectorContext.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SourceConnectorContext.java index 14fd92218a..76800d9c2f 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SourceConnectorContext.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/connector/SourceConnectorContext.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.openconnect.api.connector; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; +import org.apache.eventmesh.common.config.connector.SourceConfig; import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.OffsetStorageReader; import lombok.Data; diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/util/ConfigUtil.java b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/util/ConfigUtil.java index 13f1d74f6b..066dae3385 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/util/ConfigUtil.java +++ b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/util/ConfigUtil.java @@ -17,10 +17,10 @@ package org.apache.eventmesh.openconnect.util; -import org.apache.eventmesh.openconnect.api.config.Config; -import org.apache.eventmesh.openconnect.api.config.Constants; -import org.apache.eventmesh.openconnect.api.config.SinkConfig; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; +import org.apache.eventmesh.common.config.connector.Config; +import org.apache.eventmesh.common.config.connector.Constants; +import org.apache.eventmesh.common.config.connector.SinkConfig; +import org.apache.eventmesh.common.config.connector.SourceConfig; import java.io.File; import java.io.FileNotFoundException; diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/build.gradle b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/build.gradle index c5ac62b00f..d40f77304c 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/build.gradle +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/build.gradle @@ -16,6 +16,7 @@ */ dependencies { + implementation project(":eventmesh-common") api project(":eventmesh-spi") api "org.slf4j:slf4j-api" implementation "org.apache.logging.log4j:log4j-api" diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/config/OffsetStorageConfig.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/config/OffsetStorageConfig.java deleted file mode 100644 index 30a56a3d2f..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/config/OffsetStorageConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.openconnect.offsetmgmt.api.config; - -import java.util.Map; - -import lombok.Data; - -@Data -public class OffsetStorageConfig { - - private String offsetStorageType; - - private String offsetStorageAddr; - - private Map extensions; -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/ConnectRecord.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/ConnectRecord.java index 119f058b58..14dc17e74e 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/ConnectRecord.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/ConnectRecord.java @@ -17,6 +17,10 @@ package org.apache.eventmesh.openconnect.offsetmgmt.api.data; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; +import org.apache.eventmesh.common.remote.offset.RecordPosition; + import java.util.Objects; import java.util.Set; @@ -33,6 +37,10 @@ public class ConnectRecord { private KeyValue extensions; + public ConnectRecord() { + + } + public ConnectRecord(RecordPartition recordPartition, RecordOffset recordOffset, Long timestamp) { this(recordPartition, recordOffset, timestamp, null); diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffset.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffset.java deleted file mode 100644 index fee70de27e..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffset.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.openconnect.offsetmgmt.api.data; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -public class RecordOffset { - - /** - * if pull message from mq key=queueOffset, - * value=queueOffset value - */ - private Map offset = new HashMap<>(); - - public RecordOffset() { - - } - - public RecordOffset(Map offset) { - this.offset = offset; - } - - public Map getOffset() { - return offset; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof RecordOffset)) { - return false; - } - RecordOffset offset1 = (RecordOffset) o; - return Objects.equals(offset, offset1.offset); - } - - @Override - public int hashCode() { - return Objects.hash(offset); - } - -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffsetManagement.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffsetManagement.java index 2eaefbef29..4443c5e600 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffsetManagement.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffsetManagement.java @@ -17,6 +17,11 @@ package org.apache.eventmesh.openconnect.offsetmgmt.api.data; +import lombok.extern.slf4j.Slf4j; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; +import org.apache.eventmesh.common.remote.offset.RecordPosition; + import java.util.Collections; import java.util.Deque; import java.util.HashMap; @@ -27,8 +32,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import lombok.extern.slf4j.Slf4j; - @Slf4j public class RecordOffsetManagement { @@ -47,7 +50,7 @@ public RecordOffsetManagement() { */ public SubmittedPosition submitRecord(RecordPosition position) { SubmittedPosition submittedPosition = new SubmittedPosition(position); - records.computeIfAbsent(position.getPartition(), e -> new LinkedList<>()).add(submittedPosition); + records.computeIfAbsent(position.getRecordPartition(), e -> new LinkedList<>()).add(submittedPosition); // ensure thread safety in operation synchronized (this) { numUnacked.incrementAndGet(); @@ -63,7 +66,7 @@ private RecordOffset pollOffsetWhile(Deque submittedPositions RecordOffset offset = null; // Stop pulling if there is an uncommitted breakpoint while (canCommitHead(submittedPositions)) { - offset = submittedPositions.poll().getPosition().getOffset(); + offset = submittedPositions.poll().getPosition().getRecordOffset(); } return offset; } @@ -235,19 +238,19 @@ public void ack() { * @return */ public boolean remove() { - Deque deque = records.get(position.getPartition()); + Deque deque = records.get(position.getRecordPartition()); if (deque == null) { return false; } boolean result = deque.removeLastOccurrence(this); if (deque.isEmpty()) { - records.remove(position.getPartition()); + records.remove(position.getRecordPartition()); } if (result) { messageAcked(); } else { log.warn("Attempted to remove record from submitted queue for partition {}, " - + "but the record has not been submitted or has already been removed", position.getPartition()); + + "but the record has not been submitted or has already been removed", position.getRecordPartition()); } return result; } diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPartition.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPartition.java deleted file mode 100644 index 959a6b9b3c..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPartition.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.openconnect.offsetmgmt.api.data; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -public class RecordPartition { - - /** - * if pull message from mq key=topic, - * value=topicName key=brokerName, - * value=brokerName key=queueId, - * value=queueId - */ - private Map partition = new HashMap<>(); - - public RecordPartition() { - - } - - public RecordPartition(Map partition) { - this.partition = partition; - } - - public Map getPartition() { - return partition; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof RecordPartition)) { - return false; - } - RecordPartition partition1 = (RecordPartition) o; - return Objects.equals(partition, partition1.partition); - } - - @Override - public int hashCode() { - return Objects.hash(partition); - } -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPosition.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPosition.java deleted file mode 100644 index 0b836ab607..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPosition.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.openconnect.offsetmgmt.api.data; - -import java.util.Objects; - -public class RecordPosition { - - private final RecordPartition recordPartition; - - private final RecordOffset recordOffset; - - public RecordPosition( - RecordPartition recordPartition, RecordOffset recordOffset) { - this.recordPartition = recordPartition; - this.recordOffset = recordOffset; - } - - public RecordPartition getPartition() { - return recordPartition; - } - - public RecordOffset getOffset() { - return recordOffset; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof RecordPosition)) { - return false; - } - RecordPosition position = (RecordPosition) o; - return recordPartition.equals(position.recordPartition) && recordOffset.equals(position.recordOffset); - } - - @Override - public int hashCode() { - return Objects.hash(recordPartition, recordOffset); - } -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/ConnectorRecordPartition.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/ConnectorRecordPartition.java deleted file mode 100644 index 3308654385..0000000000 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/ConnectorRecordPartition.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.openconnect.offsetmgmt.api.storage; - -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; - -import java.util.Map; -import java.util.Objects; - -/** - * extend record partition - */ -public class ConnectorRecordPartition extends RecordPartition { - - /** - * connect name - */ - private String connectorName; - - public ConnectorRecordPartition() { - - } - - public ConnectorRecordPartition(String connectorName, Map partition) { - super(partition); - this.connectorName = connectorName; - } - - public String getConnectorName() { - return connectorName; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof ConnectorRecordPartition)) { - return false; - } - if (!super.equals(o)) { - return false; - } - ConnectorRecordPartition that = (ConnectorRecordPartition) o; - return this.connectorName.equals(that.connectorName); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), connectorName); - } -} diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/DefaultOffsetManagementServiceImpl.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/DefaultOffsetManagementServiceImpl.java index e31fc358f0..be72097911 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/DefaultOffsetManagementServiceImpl.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/DefaultOffsetManagementServiceImpl.java @@ -17,8 +17,9 @@ package org.apache.eventmesh.openconnect.offsetmgmt.api.storage; -import org.apache.eventmesh.openconnect.offsetmgmt.api.config.OffsetStorageConfig; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; +import org.apache.eventmesh.common.config.connector.offset.OffsetStorageConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import java.util.List; import java.util.Map; @@ -51,27 +52,27 @@ public void synchronize() { } @Override - public Map getPositionMap() { + public Map getPositionMap() { return null; } @Override - public RecordOffset getPosition(ConnectorRecordPartition partition) { + public RecordOffset getPosition(RecordPartition partition) { return null; } @Override - public void putPosition(Map positions) { + public void putPosition(Map positions) { } @Override - public void putPosition(ConnectorRecordPartition partition, RecordOffset position) { + public void putPosition(RecordPartition partition, RecordOffset position) { } @Override - public void removePosition(List partitions) { + public void removePosition(List partitions) { } diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetManagementService.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetManagementService.java index ef1dc0d30d..62327a1ae9 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetManagementService.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetManagementService.java @@ -17,8 +17,9 @@ package org.apache.eventmesh.openconnect.offsetmgmt.api.storage; -import org.apache.eventmesh.openconnect.offsetmgmt.api.config.OffsetStorageConfig; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; +import org.apache.eventmesh.common.config.connector.offset.OffsetStorageConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.spi.EventMeshExtensionType; import org.apache.eventmesh.spi.EventMeshSPI; @@ -49,12 +50,12 @@ default void configure(OffsetStorageConfig config) { } /** - * Persist position info in a persist store. + * Persist position info in a persisted store. */ void persist(); /** - * load position info in a persist store. + * load position info in a persisted store. */ void load(); @@ -68,24 +69,24 @@ default void configure(OffsetStorageConfig config) { * * @return */ - Map getPositionMap(); + Map getPositionMap(); - RecordOffset getPosition(ConnectorRecordPartition partition); + RecordOffset getPosition(RecordPartition partition); /** * Put a position info. */ - void putPosition(Map positions); + void putPosition(Map positions); - void putPosition(ConnectorRecordPartition partition, RecordOffset position); + void putPosition(RecordPartition partition, RecordOffset position); /** * Remove a position info. * * @param partitions */ - void removePosition(List partitions); + void removePosition(List partitions); - void initialize(OffsetStorageConfig connectorConfig); + void initialize(OffsetStorageConfig offsetStorageConfig); } diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageReader.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageReader.java index dc17e29840..30546b96cb 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageReader.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageReader.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.openconnect.offsetmgmt.api.storage; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import java.util.Collection; import java.util.Map; diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageReaderImpl.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageReaderImpl.java index efd087404e..ca4ad2c751 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageReaderImpl.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageReaderImpl.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.openconnect.offsetmgmt.api.storage; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import java.util.Collection; import java.util.HashMap; @@ -26,29 +26,24 @@ public class OffsetStorageReaderImpl implements OffsetStorageReader { - private final String connectorName; - private OffsetManagementService offsetManagementService; - public OffsetStorageReaderImpl(String connectorName, OffsetManagementService offsetManagementService) { - this.connectorName = connectorName; + public OffsetStorageReaderImpl(OffsetManagementService offsetManagementService) { this.offsetManagementService = offsetManagementService; } @Override public RecordOffset readOffset(RecordPartition partition) { - ConnectorRecordPartition connectorRecordPartition = new ConnectorRecordPartition(connectorName, partition.getPartition()); - return offsetManagementService.getPositionMap().get(connectorRecordPartition); + return offsetManagementService.getPositionMap().get(partition); } @Override public Map readOffsets(Collection partitions) { Map result = new HashMap<>(); - Map allData = offsetManagementService.getPositionMap(); + Map allData = offsetManagementService.getPositionMap(); for (RecordPartition key : partitions) { - ConnectorRecordPartition connectorRecordPartition = new ConnectorRecordPartition(connectorName, key.getPartition()); - if (allData.containsKey(connectorRecordPartition)) { - result.put(key, allData.get(connectorRecordPartition)); + if (allData.containsKey(key)) { + result.put(key, allData.get(key)); } } return result; diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageWriter.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageWriter.java index f8b6bdc45e..fb30acc918 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageWriter.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageWriter.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.openconnect.offsetmgmt.api.storage; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import java.util.Map; diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageWriterImpl.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageWriterImpl.java index 3c5ed033a8..088565cbbb 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageWriterImpl.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/storage/OffsetStorageWriterImpl.java @@ -17,8 +17,8 @@ package org.apache.eventmesh.openconnect.offsetmgmt.api.storage; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import java.io.Closeable; import java.io.IOException; @@ -35,29 +35,27 @@ @Slf4j public class OffsetStorageWriterImpl implements OffsetStorageWriter, Closeable { - private final String connectorName; private final ExecutorService executorService = Executors.newSingleThreadExecutor(); - private OffsetManagementService offsetManagementService; + private final OffsetManagementService offsetManagementService; /** * Offset data in Connect format */ - private Map data = new HashMap<>(); - private Map toFlush = null; + private Map data = new HashMap<>(); + private Map toFlush = null; // Unique ID for each flush request to handle callbacks after timeouts private long currentFlushId = 0; - public OffsetStorageWriterImpl(String connectorName, OffsetManagementService offsetManagementService) { - this.connectorName = connectorName; + public OffsetStorageWriterImpl(OffsetManagementService offsetManagementService) { this.offsetManagementService = offsetManagementService; } @Override public void writeOffset(RecordPartition partition, RecordOffset offset) { - ConnectorRecordPartition extendRecordPartition; +// RecordPartition extendRecordPartition; if (partition != null) { - extendRecordPartition = new ConnectorRecordPartition(connectorName, partition.getPartition()); - data.put(extendRecordPartition, offset); +// extendRecordPartition = new ConnectorRecordPartition(connectorName, partition.getPartitionMap()); + data.put(partition, offset); } } diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-nacos/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/nacos/NacosConfigService.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-nacos/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/nacos/NacosConfigService.java index 8d4e9dade8..67c53d4d6d 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-nacos/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/nacos/NacosConfigService.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-nacos/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/nacos/NacosConfigService.java @@ -17,9 +17,9 @@ package org.apache.eventmesh.openconnect.offsetmgmt.nacos; -import org.apache.eventmesh.openconnect.offsetmgmt.api.config.OffsetStorageConfig; -import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; -import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.ConnectorRecordPartition; +import org.apache.eventmesh.common.config.connector.offset.OffsetStorageConfig; +import org.apache.eventmesh.common.remote.offset.RecordOffset; +import org.apache.eventmesh.common.remote.offset.RecordPartition; import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.KeyValueStore; import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.MemoryBasedKeyValueStore; import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.OffsetManagementService; @@ -56,7 +56,7 @@ public class NacosConfigService implements OffsetManagementService { private Listener listener; - public KeyValueStore positionStore; + public KeyValueStore positionStore; @Override public void start() { @@ -68,19 +68,19 @@ public void start() { } // merge the updated connectorRecord & recordOffset to memory store - public void mergeOffset(ConnectorRecordPartition connectorRecordPartition, RecordOffset recordOffset) { - if (connectorRecordPartition == null || connectorRecordPartition.getPartition().isEmpty()) { + public void mergeOffset(RecordPartition recordPartition, RecordOffset recordOffset) { + if (recordPartition == null) { return; } - if (positionStore.getKVMap().containsKey(connectorRecordPartition)) { - RecordOffset existedOffset = positionStore.getKVMap().get(connectorRecordPartition); + if (positionStore.getKVMap().containsKey(recordPartition)) { + RecordOffset existedOffset = positionStore.getKVMap().get(recordPartition); // update if (!recordOffset.equals(existedOffset)) { - positionStore.put(connectorRecordPartition, recordOffset); + positionStore.put(recordPartition, recordOffset); } } else { // add new position - positionStore.put(connectorRecordPartition, recordOffset); + positionStore.put(recordPartition, recordOffset); } } @@ -108,12 +108,12 @@ public void load() { @Override public void synchronize() { try { - Map recordMap = positionStore.getKVMap(); + Map recordMap = positionStore.getKVMap(); List> recordToSyncList = new ArrayList<>(); - for (Map.Entry entry : recordMap.entrySet()) { + for (Map.Entry entry : recordMap.entrySet()) { Map synchronizeMap = new HashMap<>(); - synchronizeMap.put("connectorRecordPartition", entry.getKey()); + synchronizeMap.put("recordPartition", entry.getKey()); synchronizeMap.put("recordOffset", entry.getValue()); recordToSyncList.add(synchronizeMap); } @@ -125,13 +125,14 @@ public void synchronize() { } @Override - public Map getPositionMap() { + public Map getPositionMap() { // get from memory storage first if (positionStore.getKVMap() == null || positionStore.getKVMap().isEmpty()) { try { - Map configMap = JacksonUtils.toObj(configService.getConfig(dataId, group, 5000L), - new TypeReference>() { + Map configMap = JacksonUtils.toObj(configService.getConfig(dataId, group, 5000L), + new TypeReference>() { }); + positionStore.putAll(configMap); log.info("nacos position map {}", configMap); return configMap; } catch (NacosException e) { @@ -143,12 +144,12 @@ public Map getPositionMap() { } @Override - public RecordOffset getPosition(ConnectorRecordPartition partition) { + public RecordOffset getPosition(RecordPartition partition) { // get from memory storage first if (positionStore.get(partition) == null) { try { - Map recordMap = JacksonUtils.toObj(configService.getConfig(dataId, group, 5000L), - new TypeReference>() { + Map recordMap = JacksonUtils.toObj(configService.getConfig(dataId, group, 5000L), + new TypeReference>() { }); log.info("nacos record position {}", recordMap.get(partition)); return recordMap.get(partition); @@ -161,21 +162,21 @@ public RecordOffset getPosition(ConnectorRecordPartition partition) { } @Override - public void putPosition(Map positions) { + public void putPosition(Map positions) { positionStore.putAll(positions); } @Override - public void putPosition(ConnectorRecordPartition partition, RecordOffset position) { + public void putPosition(RecordPartition partition, RecordOffset position) { positionStore.put(partition, position); } @Override - public void removePosition(List partitions) { + public void removePosition(List partitions) { if (partitions == null) { return; } - for (ConnectorRecordPartition partition : partitions) { + for (RecordPartition partition : partitions) { positionStore.remove(partition); } } @@ -206,13 +207,13 @@ public void receiveConfigInfo(String configInfo) { }); for (Map recordPartitionOffsetMap : recordOffsetList) { - ConnectorRecordPartition connectorRecordPartition = JacksonUtils.toObj( - JacksonUtils.toJson(recordPartitionOffsetMap.get("connectorRecordPartition")), - ConnectorRecordPartition.class); + RecordPartition recordPartition = JacksonUtils.toObj( + JacksonUtils.toJson(recordPartitionOffsetMap.get("recordPartition")), + RecordPartition.class); RecordOffset recordOffset = JacksonUtils.toObj(JacksonUtils.toJson(recordPartitionOffsetMap.get("recordOffset")), RecordOffset.class); // update the offset in memory store - mergeOffset(connectorRecordPartition, recordOffset); + mergeOffset(recordPartition, recordOffset); } } }; diff --git a/eventmesh-runtime-v2/build.gradle b/eventmesh-runtime-v2/build.gradle index a04d127116..d9b1e79953 100644 --- a/eventmesh-runtime-v2/build.gradle +++ b/eventmesh-runtime-v2/build.gradle @@ -13,10 +13,17 @@ dependencies { compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' + api project (":eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api") + api project (":eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-admin") implementation project(":eventmesh-openconnect:eventmesh-openconnect-java") implementation project(":eventmesh-common") + implementation project(":eventmesh-connectors:eventmesh-connector-canal") implementation project(":eventmesh-meta:eventmesh-meta-api") implementation project(":eventmesh-meta:eventmesh-meta-nacos") + implementation project(":eventmesh-registry:eventmesh-registry-api") + implementation project(":eventmesh-registry:eventmesh-registry-nacos") + implementation project(":eventmesh-storage-plugin:eventmesh-storage-api") + implementation project(":eventmesh-storage-plugin:eventmesh-storage-standalone") implementation "io.grpc:grpc-core" implementation "io.grpc:grpc-protobuf" diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/RuntimeInstanceConfig.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/RuntimeInstanceConfig.java index ab2938ac21..4f1a4050a0 100644 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/RuntimeInstanceConfig.java +++ b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/RuntimeInstanceConfig.java @@ -1,6 +1,7 @@ package org.apache.eventmesh.runtime; import org.apache.eventmesh.common.config.Config; +import org.apache.eventmesh.common.enums.ComponentType; import lombok.Data; import lombok.NoArgsConstructor; @@ -16,14 +17,18 @@ public class RuntimeInstanceConfig { private String storagePluginType; + private String adminServiceName; + + private String adminServerAddr; + + private ComponentType componentType; + private String runtimeInstanceId; private String runtimeInstanceName; private String runtimeInstanceDesc; - private String runtimeInstanceType; - private String runtimeInstanceVersion; private String runtimeInstanceConfig; diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/boot/RuntimeInstance.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/boot/RuntimeInstance.java index 9c481463a4..dc37db1da2 100644 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/boot/RuntimeInstance.java +++ b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/boot/RuntimeInstance.java @@ -1,100 +1,129 @@ package org.apache.eventmesh.runtime.boot; +import lombok.extern.slf4j.Slf4j; + +import org.apache.commons.lang3.StringUtils; + +import org.apache.eventmesh.registry.QueryInstances; +import org.apache.eventmesh.registry.RegisterServerInfo; +import org.apache.eventmesh.registry.RegistryFactory; +import org.apache.eventmesh.registry.RegistryService; import org.apache.eventmesh.runtime.Runtime; import org.apache.eventmesh.runtime.RuntimeFactory; import org.apache.eventmesh.runtime.RuntimeInstanceConfig; -import org.apache.eventmesh.runtime.meta.MetaStorage; -import org.apache.eventmesh.runtime.rpc.AdminBiStreamServiceGrpc; -import org.apache.eventmesh.runtime.rpc.AdminBiStreamServiceGrpc.AdminBiStreamServiceStub; -import org.apache.eventmesh.runtime.rpc.Payload; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.stub.StreamObserver; +import org.apache.eventmesh.runtime.connector.ConnectorRuntimeFactory; +import org.apache.eventmesh.runtime.function.FunctionRuntimeFactory; +import org.apache.eventmesh.runtime.mesh.MeshRuntimeFactory; -import com.google.protobuf.Any; -import com.google.protobuf.StringValue; - -import lombok.extern.slf4j.Slf4j; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; @Slf4j public class RuntimeInstance { - private String adminServerAddr = "localhost"; - - private int adminServerPort = 50051; + private String adminServerAddr = "127.0.0.1:8081"; - private ManagedChannel channel; + private Map adminServerInfoMap = new HashMap<>(); - private AdminBiStreamServiceStub adminStub; - - StreamObserver responseObserver; - - StreamObserver requestObserver; - - private MetaStorage metaStorage; + private final RegistryService registryService; private Runtime runtime; private RuntimeFactory runtimeFactory; - private RuntimeInstanceConfig runtimeInstanceConfig; + private final RuntimeInstanceConfig runtimeInstanceConfig; + + private volatile boolean isStarted = false; public RuntimeInstance(RuntimeInstanceConfig runtimeInstanceConfig) { this.runtimeInstanceConfig = runtimeInstanceConfig; - this.metaStorage = MetaStorage.getInstance(runtimeInstanceConfig.getRegistryPluginType()); + this.registryService = RegistryFactory.getInstance(runtimeInstanceConfig.getRegistryPluginType()); } - public void init () { - metaStorage.init(); - + public void init() throws Exception { + registryService.init(); + QueryInstances queryInstances = new QueryInstances(); + queryInstances.setServiceName(runtimeInstanceConfig.getAdminServiceName()); + queryInstances.setHealth(true); + List adminServerRegisterInfoList = registryService.selectInstances(queryInstances); + if (!adminServerRegisterInfoList.isEmpty()) { + adminServerAddr = getRandomAdminServerAddr(adminServerRegisterInfoList); + } else { + throw new RuntimeException("admin server address is empty, please check"); + } + runtimeInstanceConfig.setAdminServerAddr(adminServerAddr); + runtimeFactory = initRuntimeFactory(runtimeInstanceConfig); + runtime = runtimeFactory.createRuntime(runtimeInstanceConfig); + runtime.init(); } - public void start() { - metaStorage.start(); - - // TODO:从registry发现admin server地址列表 - - // 创建gRPC通道 - channel = ManagedChannelBuilder.forAddress(adminServerAddr, adminServerPort) - .usePlaintext() - .build(); - - adminStub = AdminBiStreamServiceGrpc.newStub(channel); - - responseObserver = new StreamObserver() { - @Override - public void onNext(Payload response) { - log.info("runtime receive message: {} ", response); - } + public void start() throws Exception { + if (!StringUtils.isBlank(adminServerAddr)) { + + registryService.subscribe((event) -> { + log.info("runtime receive registry event: {}", event); + List registerServerInfoList = event.getInstances(); + Map registerServerInfoMap = new HashMap<>(); + for (RegisterServerInfo registerServerInfo : registerServerInfoList) { + registerServerInfoMap.put(registerServerInfo.getAddress(), registerServerInfo); + } + if (!registerServerInfoMap.isEmpty()) { + adminServerInfoMap = registerServerInfoMap; + updateAdminServerAddr(); + } + + }, runtimeInstanceConfig.getAdminServiceName()); + runtime.start(); + isStarted = true; + } else { + throw new RuntimeException("admin server address is empty, please check"); + } + } - @Override - public void onError(Throwable t) { - log.error("runtime receive error message: {}", t.getMessage()); - } + public void shutdown() throws Exception { + runtime.stop(); + } - @Override - public void onCompleted() { - log.info("runtime finished receive message and completed"); + private void updateAdminServerAddr() throws Exception { + if (isStarted) { + if (!adminServerInfoMap.containsKey(adminServerAddr)) { + adminServerAddr = getRandomAdminServerAddr(adminServerInfoMap); + log.info("admin server address changed to: {}", adminServerAddr); + shutdown(); + start(); } - }; - - requestObserver = adminStub.invokeBiStream(responseObserver); - StringValue stringValue = StringValue.newBuilder().setValue("test").build(); - Any test = Any.pack(stringValue); - // 发送请求 - for (int i = 0; i < 10; i++) { - Payload request = Payload.newBuilder() - .setBody(test) - .build(); - requestObserver.onNext(request); + } else { + adminServerAddr = getRandomAdminServerAddr(adminServerInfoMap); } + } + private String getRandomAdminServerAddr(Map adminServerInfoMap) { + ArrayList addresses = new ArrayList<>(adminServerInfoMap.keySet()); + Random random = new Random(); + int randomIndex = random.nextInt(addresses.size()); + return addresses.get(randomIndex); } - public void shutdown(){ - requestObserver.onCompleted(); - channel.shutdown(); + private String getRandomAdminServerAddr(List adminServerRegisterInfoList) { + Random random = new Random(); + int randomIndex = random.nextInt(adminServerRegisterInfoList.size()); + return adminServerRegisterInfoList.get(randomIndex).getAddress(); + } + + private RuntimeFactory initRuntimeFactory(RuntimeInstanceConfig runtimeInstanceConfig) { + switch (runtimeInstanceConfig.getComponentType()) { + case CONNECTOR: + return new ConnectorRuntimeFactory(); + case FUNCTION: + return new FunctionRuntimeFactory(); + case MESH: + return new MeshRuntimeFactory(); + default: + throw new RuntimeException("unsupported runtime type: " + runtimeInstanceConfig.getComponentType()); + } } } diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/boot/RuntimeInstanceStarter.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/boot/RuntimeInstanceStarter.java index bea493b757..c58c8a69a4 100644 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/boot/RuntimeInstanceStarter.java +++ b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/boot/RuntimeInstanceStarter.java @@ -2,30 +2,14 @@ import org.apache.eventmesh.common.config.ConfigService; import org.apache.eventmesh.runtime.RuntimeInstanceConfig; -import org.apache.eventmesh.runtime.rpc.AdminBiStreamServiceGrpc; -import org.apache.eventmesh.runtime.rpc.AdminBiStreamServiceGrpc.AdminBiStreamServiceStub; -import org.apache.eventmesh.runtime.rpc.Payload; import org.apache.eventmesh.runtime.util.BannerUtil; -import java.io.File; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.stub.StreamObserver; - -import com.google.protobuf.Any; -import com.google.protobuf.StringValue; - import lombok.extern.slf4j.Slf4j; @Slf4j public class RuntimeInstanceStarter { public static void main(String[] args) { - // TODO:加载配置,从环境变量中拿到JobID,并去Admin获取Job配置 - // TODO:启动grpc server,连接META获取Admin地址,上报心跳 - // TODO:添加shutDownHook - try { RuntimeInstanceConfig runtimeInstanceConfig = ConfigService.getInstance().buildConfigInstance(RuntimeInstanceConfig.class); RuntimeInstance runtimeInstance = new RuntimeInstance(runtimeInstanceConfig); @@ -42,11 +26,11 @@ public static void main(String[] args) { log.info("runtime shutdown cost {}ms", end - start); } catch (Exception e) { - log.error("exception when shutdown.", e); + log.error("exception when shutdown {}", e.getMessage(), e); } })); } catch (Throwable e) { - log.error("runtime start fail.", e); + log.error("runtime start fail {}.", e.getMessage(), e); System.exit(-1); } diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/connector/ConnectorRuntime.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/connector/ConnectorRuntime.java index 20b3d03787..7281a82123 100644 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/connector/ConnectorRuntime.java +++ b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/connector/ConnectorRuntime.java @@ -1,28 +1,63 @@ package org.apache.eventmesh.runtime.connector; +import com.google.protobuf.Any; +import com.google.protobuf.UnsafeByteOperations; + +import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; +import io.grpc.stub.StreamObserver; + +import lombok.extern.slf4j.Slf4j; + +import org.apache.eventmesh.api.consumer.Consumer; +import org.apache.eventmesh.api.factory.StoragePluginFactory; +import org.apache.eventmesh.api.producer.Producer; import org.apache.eventmesh.common.ThreadPoolFactory; +import org.apache.eventmesh.common.config.ConfigService; +import org.apache.eventmesh.common.config.connector.SinkConfig; +import org.apache.eventmesh.common.config.connector.SourceConfig; +import org.apache.eventmesh.common.config.connector.offset.OffsetStorageConfig; +import org.apache.eventmesh.common.protocol.grpc.adminserver.AdminServiceGrpc; +import org.apache.eventmesh.common.protocol.grpc.adminserver.AdminServiceGrpc.AdminServiceBlockingStub; +import org.apache.eventmesh.common.protocol.grpc.adminserver.AdminServiceGrpc.AdminServiceStub; +import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata; +import org.apache.eventmesh.common.protocol.grpc.adminserver.Payload; +import org.apache.eventmesh.common.remote.request.ReportHeartBeatRequest; +import org.apache.eventmesh.common.remote.request.FetchJobRequest; +import org.apache.eventmesh.common.remote.response.FetchJobResponse; +import org.apache.eventmesh.common.utils.IPUtils; +import org.apache.eventmesh.common.utils.JsonUtils; import org.apache.eventmesh.openconnect.api.ConnectorCreateService; -import org.apache.eventmesh.openconnect.api.config.Config; -import org.apache.eventmesh.openconnect.api.config.SinkConfig; -import org.apache.eventmesh.openconnect.api.config.SourceConfig; -import org.apache.eventmesh.openconnect.api.connector.Connector; -import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; +import org.apache.eventmesh.openconnect.api.callback.SendMessageCallback; import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; import org.apache.eventmesh.openconnect.api.connector.SourceConnectorContext; import org.apache.eventmesh.openconnect.api.factory.ConnectorPluginFactory; import org.apache.eventmesh.openconnect.api.sink.Sink; import org.apache.eventmesh.openconnect.api.source.Source; import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffsetManagement; +import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.DefaultOffsetManagementServiceImpl; +import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.OffsetManagementService; +import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.OffsetStorageReaderImpl; +import org.apache.eventmesh.openconnect.offsetmgmt.api.storage.OffsetStorageWriterImpl; import org.apache.eventmesh.openconnect.util.ConfigUtil; import org.apache.eventmesh.runtime.Runtime; import org.apache.eventmesh.runtime.RuntimeInstanceConfig; +import org.apache.eventmesh.spi.EventMeshExtensionFactory; +import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.Optional; import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; - -import lombok.extern.slf4j.Slf4j; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; @Slf4j public class ConnectorRuntime implements Runtime { @@ -31,20 +66,48 @@ public class ConnectorRuntime implements Runtime { private ConnectorRuntimeConfig connectorRuntimeConfig; + private ManagedChannel channel; + + private AdminServiceStub adminServiceStub; + + private AdminServiceBlockingStub adminServiceBlockingStub; + + StreamObserver responseObserver; + + StreamObserver requestObserver; + private Source sourceConnector; private Sink sinkConnector; + private OffsetStorageWriterImpl offsetStorageWriter; + + private OffsetStorageReaderImpl offsetStorageReader; + + private OffsetManagementService offsetManagementService; + + private RecordOffsetManagement offsetManagement; + + private volatile RecordOffsetManagement.CommittableOffsets committableOffsets; + + private Producer producer; + + private Consumer consumer; + private final ExecutorService sourceService = ThreadPoolFactory.createSingleExecutor("eventMesh-sourceService"); - private final ExecutorService startService = - ThreadPoolFactory.createSingleExecutor("eventMesh-sourceWorker-startService"); + private final ExecutorService sinkService = + ThreadPoolFactory.createSingleExecutor("eventMesh-sinkService"); - private BlockingQueue queue; + private final ScheduledExecutorService heartBeatExecutor = Executors.newSingleThreadScheduledExecutor(); + + private final BlockingQueue queue; private volatile boolean isRunning = false; + public static final String CALLBACK_EXTENSION = "callBackExtension"; + public ConnectorRuntime(RuntimeInstanceConfig runtimeInstanceConfig) { this.runtimeInstanceConfig = runtimeInstanceConfig; @@ -53,63 +116,309 @@ public ConnectorRuntime(RuntimeInstanceConfig runtimeInstanceConfig) { @Override public void init() throws Exception { + + initAdminService(); + + initStorageService(); + + initConnectorService(); + } + + private void initAdminService() { + // create gRPC channel + channel = ManagedChannelBuilder.forTarget(runtimeInstanceConfig.getAdminServerAddr()) + .usePlaintext() + .build(); + + adminServiceStub = AdminServiceGrpc.newStub(channel).withWaitForReady(); + + adminServiceBlockingStub = AdminServiceGrpc.newBlockingStub(channel).withWaitForReady(); + + responseObserver = new StreamObserver() { + @Override + public void onNext(Payload response) { + log.info("runtime receive message: {} ", response); + } + + @Override + public void onError(Throwable t) { + log.error("runtime receive error message: {}", t.getMessage()); + } + + @Override + public void onCompleted() { + log.info("runtime finished receive message and completed"); + } + }; + + requestObserver = adminServiceStub.invokeBiStream(responseObserver); + } + + private void initStorageService() { + // TODO: init producer & consumer + producer = StoragePluginFactory.getMeshMQProducer(runtimeInstanceConfig.getStoragePluginType()); + + consumer = StoragePluginFactory.getMeshMQPushConsumer(runtimeInstanceConfig.getStoragePluginType()); + + } + + private void initConnectorService() throws Exception { + + connectorRuntimeConfig = ConfigService.getInstance().buildConfigInstance(ConnectorRuntimeConfig.class); + + FetchJobResponse jobResponse = fetchJobConfig(); + + if (jobResponse == null) { + throw new RuntimeException("fetch job config fail"); + } + + connectorRuntimeConfig.setSourceConnectorType(jobResponse.getTransportType().getSrc().getName()); + connectorRuntimeConfig.setSourceConnectorDesc(jobResponse.getSourceConnectorDesc()); + connectorRuntimeConfig.setSourceConnectorConfig(jobResponse.getSourceConnectorConfig()); + + connectorRuntimeConfig.setSinkConnectorType(jobResponse.getTransportType().getDst().getName()); + connectorRuntimeConfig.setSinkConnectorDesc(jobResponse.getSinkConnectorDesc()); + connectorRuntimeConfig.setSinkConnectorConfig(jobResponse.getSinkConnectorConfig()); + ConnectorCreateService sourceConnectorCreateService = ConnectorPluginFactory.createConnector( - connectorRuntimeConfig.getSourceConnectorType()); - sourceConnector = (Source)sourceConnectorCreateService.create(); + connectorRuntimeConfig.getSourceConnectorType() + "-Source"); + sourceConnector = (Source) sourceConnectorCreateService.create(); SourceConfig sourceConfig = (SourceConfig) ConfigUtil.parse(connectorRuntimeConfig.getSourceConnectorConfig(), sourceConnector.configClass()); SourceConnectorContext sourceConnectorContext = new SourceConnectorContext(); sourceConnectorContext.setSourceConfig(sourceConfig); -// sourceConnectorContext.setOffsetStorageReader(offsetStorageReader); + sourceConnectorContext.setOffsetStorageReader(offsetStorageReader); + + // spi load offsetMgmtService + this.offsetManagement = new RecordOffsetManagement(); + this.committableOffsets = RecordOffsetManagement.CommittableOffsets.EMPTY; + OffsetStorageConfig offsetStorageConfig = sourceConfig.getOffsetStorageConfig(); + offsetStorageConfig.setDataSourceType(jobResponse.getTransportType().getSrc()); + offsetStorageConfig.setDataSinkType(jobResponse.getTransportType().getDst()); + this.offsetManagementService = Optional.ofNullable(offsetStorageConfig) + .map(OffsetStorageConfig::getOffsetStorageType) + .map(storageType -> EventMeshExtensionFactory.getExtension(OffsetManagementService.class, storageType)) + .orElse(new DefaultOffsetManagementServiceImpl()); + this.offsetManagementService.initialize(offsetStorageConfig); + this.offsetStorageWriter = new OffsetStorageWriterImpl(offsetManagementService); + this.offsetStorageReader = new OffsetStorageReaderImpl(offsetManagementService); sourceConnector.init(sourceConnectorContext); - ConnectorCreateService sinkConnectorCreateService = ConnectorPluginFactory.createConnector(connectorRuntimeConfig.getSinkConnectorType()); - sinkConnector = (Sink)sinkConnectorCreateService.create(); + ConnectorCreateService sinkConnectorCreateService = + ConnectorPluginFactory.createConnector(connectorRuntimeConfig.getSinkConnectorType() + "-Sink"); + sinkConnector = (Sink) sinkConnectorCreateService.create(); SinkConfig sinkConfig = (SinkConfig) ConfigUtil.parse(connectorRuntimeConfig.getSinkConnectorConfig(), sinkConnector.configClass()); SinkConnectorContext sinkConnectorContext = new SinkConnectorContext(); sinkConnectorContext.setSinkConfig(sinkConfig); sinkConnector.init(sinkConnectorContext); + + } + + private FetchJobResponse fetchJobConfig() { + String jobId = connectorRuntimeConfig.getJobID(); + FetchJobRequest jobRequest = new FetchJobRequest(); + jobRequest.setJobID(jobId); + + Metadata metadata = Metadata.newBuilder() + .setType(FetchJobRequest.class.getSimpleName()) + .build(); + + Payload request = Payload.newBuilder() + .setMetadata(metadata) + .setBody(Any.newBuilder().setValue(UnsafeByteOperations. + unsafeWrap(Objects.requireNonNull(JsonUtils.toJSONBytes(jobRequest)))).build()) + .build(); + Payload response = adminServiceBlockingStub.invoke(request); + if (response.getMetadata().getType().equals(FetchJobResponse.class.getSimpleName())) { + return JsonUtils.parseObject(response.getBody().getValue().toStringUtf8(), FetchJobResponse.class); + } + return null; } @Override public void start() throws Exception { -// sourceConnector.start(); -// sourceConnector.poll(); -// start offsetMgmtService -// offsetManagementService.start(); - isRunning = true; -// pollService.execute(this::startPollAndSend); + heartBeatExecutor.scheduleAtFixedRate(() -> { + + ReportHeartBeatRequest heartBeat = new ReportHeartBeatRequest(); + heartBeat.setAddress(IPUtils.getLocalAddress()); + heartBeat.setReportedTimeStamp(String.valueOf(System.currentTimeMillis())); + heartBeat.setJobID(connectorRuntimeConfig.getJobID()); + + Metadata metadata = Metadata.newBuilder() + .setType(ReportHeartBeatRequest.class.getSimpleName()) + .build(); + + Payload request = Payload.newBuilder() + .setMetadata(metadata) + .setBody(Any.newBuilder().setValue(UnsafeByteOperations. + unsafeWrap(Objects.requireNonNull(JsonUtils.toJSONBytes(heartBeat)))).build()) + .build(); + + requestObserver.onNext(request); + }, 5, 5, TimeUnit.SECONDS); + // start offsetMgmtService + offsetManagementService.start(); + isRunning = true; + // start sinkService + sinkService.execute( + () -> { + try { + startSinkConnector(); + } catch (Exception e) { + log.error("sink connector [{}] start fail", sinkConnector.name(), e); + try { + this.stop(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + }); + // start sourceService.execute( () -> { try { startSourceConnector(); } catch (Exception e) { log.error("source connector [{}] start fail", sourceConnector.name(), e); -// this.stop(); + try { + this.stop(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } } }); - - } @Override public void stop() throws Exception { - + sourceConnector.stop(); + sinkConnector.stop(); + heartBeatExecutor.shutdown(); + requestObserver.onCompleted(); + if (channel != null && !channel.isShutdown()) { + channel.shutdown(); + } } private void startSourceConnector() throws Exception { sourceConnector.start(); while (isRunning) { List connectorRecordList = sourceConnector.poll(); + // TODO: use producer pub record to storage replace below if (connectorRecordList != null && !connectorRecordList.isEmpty()) { for (ConnectRecord record : connectorRecordList) { queue.put(record); + Optional submittedRecordPosition = prepareToUpdateRecordOffset(record); + Optional callback = Optional.ofNullable(record.getExtensionObj(CALLBACK_EXTENSION)) + .map(v -> (SendMessageCallback) v); + // commit record + this.sourceConnector.commit(record); + submittedRecordPosition.ifPresent(RecordOffsetManagement.SubmittedPosition::ack); + // TODO:finish the optional callback +// callback.ifPresent(cb -> cb.onSuccess(record)); + offsetManagement.awaitAllMessages(5000, TimeUnit.MILLISECONDS); + // update & commit offset + updateCommittableOffsets(); + commitOffsets(); } } } } + + public Optional prepareToUpdateRecordOffset(ConnectRecord record) { + return Optional.of(this.offsetManagement.submitRecord(record.getPosition())); + } + + public void updateCommittableOffsets() { + RecordOffsetManagement.CommittableOffsets newOffsets = offsetManagement.committableOffsets(); + synchronized (this) { + this.committableOffsets = this.committableOffsets.updatedWith(newOffsets); + } + } + + public boolean commitOffsets() { + log.info("Start Committing offsets"); + + long timeout = System.currentTimeMillis() + 5000L; + + RecordOffsetManagement.CommittableOffsets offsetsToCommit; + synchronized (this) { + offsetsToCommit = this.committableOffsets; + this.committableOffsets = RecordOffsetManagement.CommittableOffsets.EMPTY; + } + + if (committableOffsets.isEmpty()) { + log.debug("Either no records were produced since the last offset commit, " + + "or every record has been filtered out by a transformation " + + "or dropped due to transformation or conversion errors."); + // We continue with the offset commit process here instead of simply returning immediately + // in order to invoke SourceTask::commit and record metrics for a successful offset commit + } else { + log.info("{} Committing offsets for {} acknowledged messages", this, committableOffsets.numCommittableMessages()); + if (committableOffsets.hasPending()) { + log.debug("{} There are currently {} pending messages spread across {} source partitions whose offsets will not be committed. " + + "The source partition with the most pending messages is {}, with {} pending messages", + this, + committableOffsets.numUncommittableMessages(), + committableOffsets.numDeques(), + committableOffsets.largestDequePartition(), + committableOffsets.largestDequeSize()); + } else { + log.debug("{} There are currently no pending messages for this offset commit; " + + "all messages dispatched to the task's producer since the last commit have been acknowledged", + this); + } + } + + // write offset to memory + offsetsToCommit.offsets().forEach(offsetStorageWriter::writeOffset); + + // begin flush + if (!offsetStorageWriter.beginFlush()) { + return true; + } + + // using offsetManagementService to persist offset + Future flushFuture = offsetStorageWriter.doFlush(); + try { + flushFuture.get(Math.max(timeout - System.currentTimeMillis(), 0), TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + log.warn("{} Flush of offsets interrupted, cancelling", this); + offsetStorageWriter.cancelFlush(); + return false; + } catch (ExecutionException e) { + log.error("{} Flush of offsets threw an unexpected exception: ", this, e); + offsetStorageWriter.cancelFlush(); + return false; + } catch (TimeoutException e) { + log.error("{} Timed out waiting to flush offsets to storage; will try again on next flush interval with latest offsets", this); + offsetStorageWriter.cancelFlush(); + return false; + } + return true; + } + + private void startSinkConnector() throws Exception { + sinkConnector.start(); + while (isRunning) { + // TODO: use consumer sub from storage to replace below + ConnectRecord connectRecord = null; + try { + connectRecord = queue.poll(5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + log.error("poll connect record error", e); + } + if (connectRecord == null) { + continue; + } + List connectRecordList = new ArrayList<>(); + connectRecordList.add(connectRecord); + sinkConnector.put(connectRecordList); + } + } } diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/connector/ConnectorRuntimeConfig.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/connector/ConnectorRuntimeConfig.java index 426645faed..e3c722c6b7 100644 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/connector/ConnectorRuntimeConfig.java +++ b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/connector/ConnectorRuntimeConfig.java @@ -1,16 +1,21 @@ package org.apache.eventmesh.runtime.connector; +import org.apache.eventmesh.common.config.Config; + import java.util.Map; import lombok.Data; +import lombok.NoArgsConstructor; @Data +@NoArgsConstructor +@Config(path = "classPath://connector.yaml") public class ConnectorRuntimeConfig { - private String connectorName; - private String connectorRuntimeInstanceId; + private String jobID; + private String sourceConnectorType; private String sourceConnectorDesc; diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/AdminBiStreamServiceGrpc.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/AdminBiStreamServiceGrpc.java deleted file mode 100644 index 2d591b0486..0000000000 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/AdminBiStreamServiceGrpc.java +++ /dev/null @@ -1,260 +0,0 @@ -package org.apache.eventmesh.runtime.rpc; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - */ -@javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.40.0)", - comments = "Source: event_mesh_admin_service.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class AdminBiStreamServiceGrpc { - - private AdminBiStreamServiceGrpc() {} - - public static final String SERVICE_NAME = "AdminBiStreamService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getInvokeBiStreamMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "invokeBiStream", - requestType = Payload.class, - responseType = Payload.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getInvokeBiStreamMethod() { - io.grpc.MethodDescriptor getInvokeBiStreamMethod; - if ((getInvokeBiStreamMethod = AdminBiStreamServiceGrpc.getInvokeBiStreamMethod) == null) { - synchronized (AdminBiStreamServiceGrpc.class) { - if ((getInvokeBiStreamMethod = AdminBiStreamServiceGrpc.getInvokeBiStreamMethod) == null) { - AdminBiStreamServiceGrpc.getInvokeBiStreamMethod = getInvokeBiStreamMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "invokeBiStream")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - Payload.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - Payload.getDefaultInstance())) - .setSchemaDescriptor(new AdminBiStreamServiceMethodDescriptorSupplier("invokeBiStream")) - .build(); - } - } - } - return getInvokeBiStreamMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static AdminBiStreamServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @Override - public AdminBiStreamServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminBiStreamServiceStub(channel, callOptions); - } - }; - return AdminBiStreamServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static AdminBiStreamServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @Override - public AdminBiStreamServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminBiStreamServiceBlockingStub(channel, callOptions); - } - }; - return AdminBiStreamServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static AdminBiStreamServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @Override - public AdminBiStreamServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminBiStreamServiceFutureStub(channel, callOptions); - } - }; - return AdminBiStreamServiceFutureStub.newStub(factory, channel); - } - - /** - */ - public static abstract class AdminBiStreamServiceImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver invokeBiStream( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getInvokeBiStreamMethod(), responseObserver); - } - - @Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getInvokeBiStreamMethod(), - io.grpc.stub.ServerCalls.asyncBidiStreamingCall( - new MethodHandlers< - Payload, - Payload>( - this, METHODID_INVOKE_BI_STREAM))) - .build(); - } - } - - /** - */ - public static final class AdminBiStreamServiceStub extends io.grpc.stub.AbstractAsyncStub { - private AdminBiStreamServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @Override - protected AdminBiStreamServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminBiStreamServiceStub(channel, callOptions); - } - - /** - */ - public io.grpc.stub.StreamObserver invokeBiStream( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( - getChannel().newCall(getInvokeBiStreamMethod(), getCallOptions()), responseObserver); - } - } - - /** - */ - public static final class AdminBiStreamServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private AdminBiStreamServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @Override - protected AdminBiStreamServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminBiStreamServiceBlockingStub(channel, callOptions); - } - } - - /** - */ - public static final class AdminBiStreamServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private AdminBiStreamServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @Override - protected AdminBiStreamServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminBiStreamServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_INVOKE_BI_STREAM = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final AdminBiStreamServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(AdminBiStreamServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @Override - @SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - - @Override - @SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_INVOKE_BI_STREAM: - return (io.grpc.stub.StreamObserver) serviceImpl.invokeBiStream( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - private static abstract class AdminBiStreamServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - AdminBiStreamServiceBaseDescriptorSupplier() {} - - @Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return EventMeshAdminService.getDescriptor(); - } - - @Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("AdminBiStreamService"); - } - } - - private static final class AdminBiStreamServiceFileDescriptorSupplier - extends AdminBiStreamServiceBaseDescriptorSupplier { - AdminBiStreamServiceFileDescriptorSupplier() {} - } - - private static final class AdminBiStreamServiceMethodDescriptorSupplier - extends AdminBiStreamServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - AdminBiStreamServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (AdminBiStreamServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new AdminBiStreamServiceFileDescriptorSupplier()) - .addMethod(getInvokeBiStreamMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/AdminServiceGrpc.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/AdminServiceGrpc.java deleted file mode 100644 index d6c17139f3..0000000000 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/AdminServiceGrpc.java +++ /dev/null @@ -1,276 +0,0 @@ -package org.apache.eventmesh.runtime.rpc; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - */ -@javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.40.0)", - comments = "Source: event_mesh_admin_service.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class AdminServiceGrpc { - - private AdminServiceGrpc() {} - - public static final String SERVICE_NAME = "AdminService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getInvokeMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "invoke", - requestType = Payload.class, - responseType = Payload.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getInvokeMethod() { - io.grpc.MethodDescriptor getInvokeMethod; - if ((getInvokeMethod = AdminServiceGrpc.getInvokeMethod) == null) { - synchronized (AdminServiceGrpc.class) { - if ((getInvokeMethod = AdminServiceGrpc.getInvokeMethod) == null) { - AdminServiceGrpc.getInvokeMethod = getInvokeMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "invoke")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - Payload.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - Payload.getDefaultInstance())) - .setSchemaDescriptor(new AdminServiceMethodDescriptorSupplier("invoke")) - .build(); - } - } - } - return getInvokeMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static AdminServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @Override - public AdminServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminServiceStub(channel, callOptions); - } - }; - return AdminServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static AdminServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @Override - public AdminServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminServiceBlockingStub(channel, callOptions); - } - }; - return AdminServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static AdminServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @Override - public AdminServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminServiceFutureStub(channel, callOptions); - } - }; - return AdminServiceFutureStub.newStub(factory, channel); - } - - /** - */ - public static abstract class AdminServiceImplBase implements io.grpc.BindableService { - - /** - */ - public void invoke(Payload request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getInvokeMethod(), responseObserver); - } - - @Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getInvokeMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - Payload, - Payload>( - this, METHODID_INVOKE))) - .build(); - } - } - - /** - */ - public static final class AdminServiceStub extends io.grpc.stub.AbstractAsyncStub { - private AdminServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @Override - protected AdminServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminServiceStub(channel, callOptions); - } - - /** - */ - public void invoke(Payload request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getInvokeMethod(), getCallOptions()), request, responseObserver); - } - } - - /** - */ - public static final class AdminServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private AdminServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @Override - protected AdminServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminServiceBlockingStub(channel, callOptions); - } - - /** - */ - public Payload invoke(Payload request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getInvokeMethod(), getCallOptions(), request); - } - } - - /** - */ - public static final class AdminServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private AdminServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @Override - protected AdminServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new AdminServiceFutureStub(channel, callOptions); - } - - /** - */ - public com.google.common.util.concurrent.ListenableFuture invoke( - Payload request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getInvokeMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_INVOKE = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final AdminServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(AdminServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @Override - @SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_INVOKE: - serviceImpl.invoke((Payload) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - default: - throw new AssertionError(); - } - } - - @Override - @SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - } - - private static abstract class AdminServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - AdminServiceBaseDescriptorSupplier() {} - - @Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return EventMeshAdminService.getDescriptor(); - } - - @Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("AdminService"); - } - } - - private static final class AdminServiceFileDescriptorSupplier - extends AdminServiceBaseDescriptorSupplier { - AdminServiceFileDescriptorSupplier() {} - } - - private static final class AdminServiceMethodDescriptorSupplier - extends AdminServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - AdminServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (AdminServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new AdminServiceFileDescriptorSupplier()) - .addMethod(getInvokeMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/EventMeshAdminService.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/EventMeshAdminService.java deleted file mode 100644 index f188113ce4..0000000000 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/EventMeshAdminService.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.apache.eventmesh.runtime.rpc;// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: event_mesh_admin_service.proto - -public final class EventMeshAdminService { - private EventMeshAdminService() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_Metadata_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Metadata_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_Metadata_HeadersEntry_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Metadata_HeadersEntry_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_Payload_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Payload_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - String[] descriptorData = { - "\n\036event_mesh_admin_service.proto\032\031google" + - "/protobuf/any.proto\"q\n\010Metadata\022\014\n\004type\030" + - "\003 \001(\t\022\'\n\007headers\030\007 \003(\0132\026.Metadata.Header" + - "sEntry\032.\n\014HeadersEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005v" + - "alue\030\002 \001(\t:\0028\001\"J\n\007Payload\022\033\n\010metadata\030\002 " + - "\001(\0132\t.Metadata\022\"\n\004body\030\003 \001(\0132\024.google.pr" + - "otobuf.Any2B\n\024AdminBiStreamService\022*\n\016in" + - "vokeBiStream\022\010.Payload\032\010.Payload\"\000(\0010\0012." + - "\n\014AdminService\022\036\n\006invoke\022\010.Payload\032\010.Pay" + - "load\"\000B\002P\001b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.protobuf.AnyProto.getDescriptor(), - }); - internal_static_Metadata_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_Metadata_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Metadata_descriptor, - new String[] { "Type", "Headers", }); - internal_static_Metadata_HeadersEntry_descriptor = - internal_static_Metadata_descriptor.getNestedTypes().get(0); - internal_static_Metadata_HeadersEntry_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Metadata_HeadersEntry_descriptor, - new String[] { "Key", "Value", }); - internal_static_Payload_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_Payload_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Payload_descriptor, - new String[] { "Metadata", "Body", }); - com.google.protobuf.AnyProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/Metadata.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/Metadata.java deleted file mode 100644 index 37773945f4..0000000000 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/Metadata.java +++ /dev/null @@ -1,841 +0,0 @@ -package org.apache.eventmesh.runtime.rpc;// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: event_mesh_admin_service.proto - -/** - * Protobuf type {@code Metadata} - */ -public final class Metadata extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Metadata) - MetadataOrBuilder { -private static final long serialVersionUID = 0L; - // Use Metadata.newBuilder() to construct. - private Metadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Metadata() { - type_ = ""; - } - - @Override - @SuppressWarnings({"unused"}) - protected Object newInstance( - UnusedPrivateParameter unused) { - return new Metadata(); - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Metadata( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 26: { - String s = input.readStringRequireUtf8(); - - type_ = s; - break; - } - case 58: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - headers_ = com.google.protobuf.MapField.newMapField( - HeadersDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000001; - } - com.google.protobuf.MapEntry - headers__ = input.readMessage( - HeadersDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); - headers_.getMutableMap().put( - headers__.getKey(), headers__.getValue()); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return EventMeshAdminService.internal_static_Metadata_descriptor; - } - - @SuppressWarnings({"rawtypes"}) - @Override - protected com.google.protobuf.MapField internalGetMapField( - int number) { - switch (number) { - case 7: - return internalGetHeaders(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return EventMeshAdminService.internal_static_Metadata_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Metadata.class, Builder.class); - } - - public static final int TYPE_FIELD_NUMBER = 3; - private volatile Object type_; - /** - * string type = 3; - * @return The type. - */ - @Override - public String getType() { - Object ref = type_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - type_ = s; - return s; - } - } - /** - * string type = 3; - * @return The bytes for type. - */ - @Override - public com.google.protobuf.ByteString - getTypeBytes() { - Object ref = type_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - type_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int HEADERS_FIELD_NUMBER = 7; - private static final class HeadersDefaultEntryHolder { - static final com.google.protobuf.MapEntry< - String, String> defaultEntry = - com.google.protobuf.MapEntry - .newDefaultInstance( - EventMeshAdminService.internal_static_Metadata_HeadersEntry_descriptor, - com.google.protobuf.WireFormat.FieldType.STRING, - "", - com.google.protobuf.WireFormat.FieldType.STRING, - ""); - } - private com.google.protobuf.MapField< - String, String> headers_; - private com.google.protobuf.MapField - internalGetHeaders() { - if (headers_ == null) { - return com.google.protobuf.MapField.emptyMapField( - HeadersDefaultEntryHolder.defaultEntry); - } - return headers_; - } - - public int getHeadersCount() { - return internalGetHeaders().getMap().size(); - } - /** - * map<string, string> headers = 7; - */ - - @Override - public boolean containsHeaders( - String key) { - if (key == null) { throw new NullPointerException(); } - return internalGetHeaders().getMap().containsKey(key); - } - /** - * Use {@link #getHeadersMap()} instead. - */ - @Override - @Deprecated - public java.util.Map getHeaders() { - return getHeadersMap(); - } - /** - * map<string, string> headers = 7; - */ - @Override - - public java.util.Map getHeadersMap() { - return internalGetHeaders().getMap(); - } - /** - * map<string, string> headers = 7; - */ - @Override - - public String getHeadersOrDefault( - String key, - String defaultValue) { - if (key == null) { throw new NullPointerException(); } - java.util.Map map = - internalGetHeaders().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * map<string, string> headers = 7; - */ - @Override - - public String getHeadersOrThrow( - String key) { - if (key == null) { throw new NullPointerException(); } - java.util.Map map = - internalGetHeaders().getMap(); - if (!map.containsKey(key)) { - throw new IllegalArgumentException(); - } - return map.get(key); - } - - private byte memoizedIsInitialized = -1; - @Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!getTypeBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, type_); - } - com.google.protobuf.GeneratedMessageV3 - .serializeStringMapTo( - output, - internalGetHeaders(), - HeadersDefaultEntryHolder.defaultEntry, - 7); - unknownFields.writeTo(output); - } - - @Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getTypeBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, type_); - } - for (java.util.Map.Entry entry - : internalGetHeaders().getMap().entrySet()) { - com.google.protobuf.MapEntry - headers__ = HeadersDefaultEntryHolder.defaultEntry.newBuilderForType() - .setKey(entry.getKey()) - .setValue(entry.getValue()) - .build(); - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(7, headers__); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Metadata)) { - return super.equals(obj); - } - Metadata other = (Metadata) obj; - - if (!getType() - .equals(other.getType())) return false; - if (!internalGetHeaders().equals( - other.internalGetHeaders())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + TYPE_FIELD_NUMBER; - hash = (53 * hash) + getType().hashCode(); - if (!internalGetHeaders().getMap().isEmpty()) { - hash = (37 * hash) + HEADERS_FIELD_NUMBER; - hash = (53 * hash) + internalGetHeaders().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Metadata parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Metadata parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Metadata parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Metadata parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Metadata parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Metadata parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Metadata parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Metadata parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Metadata parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Metadata parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Metadata parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Metadata parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Metadata prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Metadata} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Metadata) - MetadataOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return EventMeshAdminService.internal_static_Metadata_descriptor; - } - - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField( - int number) { - switch (number) { - case 7: - return internalGetHeaders(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField( - int number) { - switch (number) { - case 7: - return internalGetMutableHeaders(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return EventMeshAdminService.internal_static_Metadata_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Metadata.class, Builder.class); - } - - // Construct using Metadata.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @Override - public Builder clear() { - super.clear(); - type_ = ""; - - internalGetMutableHeaders().clear(); - return this; - } - - @Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return EventMeshAdminService.internal_static_Metadata_descriptor; - } - - @Override - public Metadata getDefaultInstanceForType() { - return Metadata.getDefaultInstance(); - } - - @Override - public Metadata build() { - Metadata result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @Override - public Metadata buildPartial() { - Metadata result = new Metadata(this); - int from_bitField0_ = bitField0_; - result.type_ = type_; - result.headers_ = internalGetHeaders(); - result.headers_.makeImmutable(); - onBuilt(); - return result; - } - - @Override - public Builder clone() { - return super.clone(); - } - @Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return super.setField(field, value); - } - @Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return super.setRepeatedField(field, index, value); - } - @Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return super.addRepeatedField(field, value); - } - @Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Metadata) { - return mergeFrom((Metadata)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Metadata other) { - if (other == Metadata.getDefaultInstance()) return this; - if (!other.getType().isEmpty()) { - type_ = other.type_; - onChanged(); - } - internalGetMutableHeaders().mergeFrom( - other.internalGetHeaders()); - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @Override - public final boolean isInitialized() { - return true; - } - - @Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Metadata parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Metadata) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private Object type_ = ""; - /** - * string type = 3; - * @return The type. - */ - public String getType() { - Object ref = type_; - if (!(ref instanceof String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - type_ = s; - return s; - } else { - return (String) ref; - } - } - /** - * string type = 3; - * @return The bytes for type. - */ - public com.google.protobuf.ByteString - getTypeBytes() { - Object ref = type_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - type_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string type = 3; - * @param value The type to set. - * @return This builder for chaining. - */ - public Builder setType( - String value) { - if (value == null) { - throw new NullPointerException(); - } - - type_ = value; - onChanged(); - return this; - } - /** - * string type = 3; - * @return This builder for chaining. - */ - public Builder clearType() { - - type_ = getDefaultInstance().getType(); - onChanged(); - return this; - } - /** - * string type = 3; - * @param value The bytes for type to set. - * @return This builder for chaining. - */ - public Builder setTypeBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - type_ = value; - onChanged(); - return this; - } - - private com.google.protobuf.MapField< - String, String> headers_; - private com.google.protobuf.MapField - internalGetHeaders() { - if (headers_ == null) { - return com.google.protobuf.MapField.emptyMapField( - HeadersDefaultEntryHolder.defaultEntry); - } - return headers_; - } - private com.google.protobuf.MapField - internalGetMutableHeaders() { - onChanged();; - if (headers_ == null) { - headers_ = com.google.protobuf.MapField.newMapField( - HeadersDefaultEntryHolder.defaultEntry); - } - if (!headers_.isMutable()) { - headers_ = headers_.copy(); - } - return headers_; - } - - public int getHeadersCount() { - return internalGetHeaders().getMap().size(); - } - /** - * map<string, string> headers = 7; - */ - - @Override - public boolean containsHeaders( - String key) { - if (key == null) { throw new NullPointerException(); } - return internalGetHeaders().getMap().containsKey(key); - } - /** - * Use {@link #getHeadersMap()} instead. - */ - @Override - @Deprecated - public java.util.Map getHeaders() { - return getHeadersMap(); - } - /** - * map<string, string> headers = 7; - */ - @Override - - public java.util.Map getHeadersMap() { - return internalGetHeaders().getMap(); - } - /** - * map<string, string> headers = 7; - */ - @Override - - public String getHeadersOrDefault( - String key, - String defaultValue) { - if (key == null) { throw new NullPointerException(); } - java.util.Map map = - internalGetHeaders().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * map<string, string> headers = 7; - */ - @Override - - public String getHeadersOrThrow( - String key) { - if (key == null) { throw new NullPointerException(); } - java.util.Map map = - internalGetHeaders().getMap(); - if (!map.containsKey(key)) { - throw new IllegalArgumentException(); - } - return map.get(key); - } - - public Builder clearHeaders() { - internalGetMutableHeaders().getMutableMap() - .clear(); - return this; - } - /** - * map<string, string> headers = 7; - */ - - public Builder removeHeaders( - String key) { - if (key == null) { throw new NullPointerException(); } - internalGetMutableHeaders().getMutableMap() - .remove(key); - return this; - } - /** - * Use alternate mutation accessors instead. - */ - @Deprecated - public java.util.Map - getMutableHeaders() { - return internalGetMutableHeaders().getMutableMap(); - } - /** - * map<string, string> headers = 7; - */ - public Builder putHeaders( - String key, - String value) { - if (key == null) { throw new NullPointerException(); } - if (value == null) { throw new NullPointerException(); } - internalGetMutableHeaders().getMutableMap() - .put(key, value); - return this; - } - /** - * map<string, string> headers = 7; - */ - - public Builder putAllHeaders( - java.util.Map values) { - internalGetMutableHeaders().getMutableMap() - .putAll(values); - return this; - } - @Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:Metadata) - } - - // @@protoc_insertion_point(class_scope:Metadata) - private static final Metadata DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Metadata(); - } - - public static Metadata getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @Override - public Metadata parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Metadata(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @Override - public Metadata getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/MetadataOrBuilder.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/MetadataOrBuilder.java deleted file mode 100644 index 30a3fd5ec4..0000000000 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/MetadataOrBuilder.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.apache.eventmesh.runtime.rpc;// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: event_mesh_admin_service.proto - -public interface MetadataOrBuilder extends - // @@protoc_insertion_point(interface_extends:Metadata) - com.google.protobuf.MessageOrBuilder { - - /** - * string type = 3; - * @return The type. - */ - String getType(); - /** - * string type = 3; - * @return The bytes for type. - */ - com.google.protobuf.ByteString - getTypeBytes(); - - /** - * map<string, string> headers = 7; - */ - int getHeadersCount(); - /** - * map<string, string> headers = 7; - */ - boolean containsHeaders( - String key); - /** - * Use {@link #getHeadersMap()} instead. - */ - @Deprecated - java.util.Map - getHeaders(); - /** - * map<string, string> headers = 7; - */ - java.util.Map - getHeadersMap(); - /** - * map<string, string> headers = 7; - */ - - String getHeadersOrDefault( - String key, - String defaultValue); - /** - * map<string, string> headers = 7; - */ - - String getHeadersOrThrow( - String key); -} diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/Payload.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/Payload.java deleted file mode 100644 index 30d7af8f02..0000000000 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/Payload.java +++ /dev/null @@ -1,793 +0,0 @@ -package org.apache.eventmesh.runtime.rpc;// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: event_mesh_admin_service.proto - -/** - * Protobuf type {@code Payload} - */ -public final class Payload extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Payload) - PayloadOrBuilder { -private static final long serialVersionUID = 0L; - // Use Payload.newBuilder() to construct. - private Payload(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Payload() { - } - - @Override - @SuppressWarnings({"unused"}) - protected Object newInstance( - UnusedPrivateParameter unused) { - return new Payload(); - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Payload( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 18: { - Metadata.Builder subBuilder = null; - if (metadata_ != null) { - subBuilder = metadata_.toBuilder(); - } - metadata_ = input.readMessage(Metadata.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(metadata_); - metadata_ = subBuilder.buildPartial(); - } - - break; - } - case 26: { - com.google.protobuf.Any.Builder subBuilder = null; - if (body_ != null) { - subBuilder = body_.toBuilder(); - } - body_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(body_); - body_ = subBuilder.buildPartial(); - } - - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return EventMeshAdminService.internal_static_Payload_descriptor; - } - - @Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return EventMeshAdminService.internal_static_Payload_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Payload.class, Builder.class); - } - - public static final int METADATA_FIELD_NUMBER = 2; - private Metadata metadata_; - /** - * .Metadata metadata = 2; - * @return Whether the metadata field is set. - */ - @Override - public boolean hasMetadata() { - return metadata_ != null; - } - /** - * .Metadata metadata = 2; - * @return The metadata. - */ - @Override - public Metadata getMetadata() { - return metadata_ == null ? Metadata.getDefaultInstance() : metadata_; - } - /** - * .Metadata metadata = 2; - */ - @Override - public MetadataOrBuilder getMetadataOrBuilder() { - return getMetadata(); - } - - public static final int BODY_FIELD_NUMBER = 3; - private com.google.protobuf.Any body_; - /** - * .google.protobuf.Any body = 3; - * @return Whether the body field is set. - */ - @Override - public boolean hasBody() { - return body_ != null; - } - /** - * .google.protobuf.Any body = 3; - * @return The body. - */ - @Override - public com.google.protobuf.Any getBody() { - return body_ == null ? com.google.protobuf.Any.getDefaultInstance() : body_; - } - /** - * .google.protobuf.Any body = 3; - */ - @Override - public com.google.protobuf.AnyOrBuilder getBodyOrBuilder() { - return getBody(); - } - - private byte memoizedIsInitialized = -1; - @Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (metadata_ != null) { - output.writeMessage(2, getMetadata()); - } - if (body_ != null) { - output.writeMessage(3, getBody()); - } - unknownFields.writeTo(output); - } - - @Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (metadata_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, getMetadata()); - } - if (body_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, getBody()); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Payload)) { - return super.equals(obj); - } - Payload other = (Payload) obj; - - if (hasMetadata() != other.hasMetadata()) return false; - if (hasMetadata()) { - if (!getMetadata() - .equals(other.getMetadata())) return false; - } - if (hasBody() != other.hasBody()) return false; - if (hasBody()) { - if (!getBody() - .equals(other.getBody())) return false; - } - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasMetadata()) { - hash = (37 * hash) + METADATA_FIELD_NUMBER; - hash = (53 * hash) + getMetadata().hashCode(); - } - if (hasBody()) { - hash = (37 * hash) + BODY_FIELD_NUMBER; - hash = (53 * hash) + getBody().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Payload parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Payload parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Payload parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Payload parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Payload parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Payload parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Payload parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Payload parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Payload parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Payload parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Payload parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Payload parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Payload prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Payload} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Payload) - PayloadOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return EventMeshAdminService.internal_static_Payload_descriptor; - } - - @Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return EventMeshAdminService.internal_static_Payload_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Payload.class, Builder.class); - } - - // Construct using Payload.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @Override - public Builder clear() { - super.clear(); - if (metadataBuilder_ == null) { - metadata_ = null; - } else { - metadata_ = null; - metadataBuilder_ = null; - } - if (bodyBuilder_ == null) { - body_ = null; - } else { - body_ = null; - bodyBuilder_ = null; - } - return this; - } - - @Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return EventMeshAdminService.internal_static_Payload_descriptor; - } - - @Override - public Payload getDefaultInstanceForType() { - return Payload.getDefaultInstance(); - } - - @Override - public Payload build() { - Payload result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @Override - public Payload buildPartial() { - Payload result = new Payload(this); - if (metadataBuilder_ == null) { - result.metadata_ = metadata_; - } else { - result.metadata_ = metadataBuilder_.build(); - } - if (bodyBuilder_ == null) { - result.body_ = body_; - } else { - result.body_ = bodyBuilder_.build(); - } - onBuilt(); - return result; - } - - @Override - public Builder clone() { - return super.clone(); - } - @Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return super.setField(field, value); - } - @Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return super.setRepeatedField(field, index, value); - } - @Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return super.addRepeatedField(field, value); - } - @Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Payload) { - return mergeFrom((Payload)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Payload other) { - if (other == Payload.getDefaultInstance()) return this; - if (other.hasMetadata()) { - mergeMetadata(other.getMetadata()); - } - if (other.hasBody()) { - mergeBody(other.getBody()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @Override - public final boolean isInitialized() { - return true; - } - - @Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Payload parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Payload) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private Metadata metadata_; - private com.google.protobuf.SingleFieldBuilderV3< - Metadata, Metadata.Builder, MetadataOrBuilder> metadataBuilder_; - /** - * .Metadata metadata = 2; - * @return Whether the metadata field is set. - */ - public boolean hasMetadata() { - return metadataBuilder_ != null || metadata_ != null; - } - /** - * .Metadata metadata = 2; - * @return The metadata. - */ - public Metadata getMetadata() { - if (metadataBuilder_ == null) { - return metadata_ == null ? Metadata.getDefaultInstance() : metadata_; - } else { - return metadataBuilder_.getMessage(); - } - } - /** - * .Metadata metadata = 2; - */ - public Builder setMetadata(Metadata value) { - if (metadataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - metadata_ = value; - onChanged(); - } else { - metadataBuilder_.setMessage(value); - } - - return this; - } - /** - * .Metadata metadata = 2; - */ - public Builder setMetadata( - Metadata.Builder builderForValue) { - if (metadataBuilder_ == null) { - metadata_ = builderForValue.build(); - onChanged(); - } else { - metadataBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * .Metadata metadata = 2; - */ - public Builder mergeMetadata(Metadata value) { - if (metadataBuilder_ == null) { - if (metadata_ != null) { - metadata_ = - Metadata.newBuilder(metadata_).mergeFrom(value).buildPartial(); - } else { - metadata_ = value; - } - onChanged(); - } else { - metadataBuilder_.mergeFrom(value); - } - - return this; - } - /** - * .Metadata metadata = 2; - */ - public Builder clearMetadata() { - if (metadataBuilder_ == null) { - metadata_ = null; - onChanged(); - } else { - metadata_ = null; - metadataBuilder_ = null; - } - - return this; - } - /** - * .Metadata metadata = 2; - */ - public Metadata.Builder getMetadataBuilder() { - - onChanged(); - return getMetadataFieldBuilder().getBuilder(); - } - /** - * .Metadata metadata = 2; - */ - public MetadataOrBuilder getMetadataOrBuilder() { - if (metadataBuilder_ != null) { - return metadataBuilder_.getMessageOrBuilder(); - } else { - return metadata_ == null ? - Metadata.getDefaultInstance() : metadata_; - } - } - /** - * .Metadata metadata = 2; - */ - private com.google.protobuf.SingleFieldBuilderV3< - Metadata, Metadata.Builder, MetadataOrBuilder> - getMetadataFieldBuilder() { - if (metadataBuilder_ == null) { - metadataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - Metadata, Metadata.Builder, MetadataOrBuilder>( - getMetadata(), - getParentForChildren(), - isClean()); - metadata_ = null; - } - return metadataBuilder_; - } - - private com.google.protobuf.Any body_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> bodyBuilder_; - /** - * .google.protobuf.Any body = 3; - * @return Whether the body field is set. - */ - public boolean hasBody() { - return bodyBuilder_ != null || body_ != null; - } - /** - * .google.protobuf.Any body = 3; - * @return The body. - */ - public com.google.protobuf.Any getBody() { - if (bodyBuilder_ == null) { - return body_ == null ? com.google.protobuf.Any.getDefaultInstance() : body_; - } else { - return bodyBuilder_.getMessage(); - } - } - /** - * .google.protobuf.Any body = 3; - */ - public Builder setBody(com.google.protobuf.Any value) { - if (bodyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - body_ = value; - onChanged(); - } else { - bodyBuilder_.setMessage(value); - } - - return this; - } - /** - * .google.protobuf.Any body = 3; - */ - public Builder setBody( - com.google.protobuf.Any.Builder builderForValue) { - if (bodyBuilder_ == null) { - body_ = builderForValue.build(); - onChanged(); - } else { - bodyBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * .google.protobuf.Any body = 3; - */ - public Builder mergeBody(com.google.protobuf.Any value) { - if (bodyBuilder_ == null) { - if (body_ != null) { - body_ = - com.google.protobuf.Any.newBuilder(body_).mergeFrom(value).buildPartial(); - } else { - body_ = value; - } - onChanged(); - } else { - bodyBuilder_.mergeFrom(value); - } - - return this; - } - /** - * .google.protobuf.Any body = 3; - */ - public Builder clearBody() { - if (bodyBuilder_ == null) { - body_ = null; - onChanged(); - } else { - body_ = null; - bodyBuilder_ = null; - } - - return this; - } - /** - * .google.protobuf.Any body = 3; - */ - public com.google.protobuf.Any.Builder getBodyBuilder() { - - onChanged(); - return getBodyFieldBuilder().getBuilder(); - } - /** - * .google.protobuf.Any body = 3; - */ - public com.google.protobuf.AnyOrBuilder getBodyOrBuilder() { - if (bodyBuilder_ != null) { - return bodyBuilder_.getMessageOrBuilder(); - } else { - return body_ == null ? - com.google.protobuf.Any.getDefaultInstance() : body_; - } - } - /** - * .google.protobuf.Any body = 3; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> - getBodyFieldBuilder() { - if (bodyBuilder_ == null) { - bodyBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( - getBody(), - getParentForChildren(), - isClean()); - body_ = null; - } - return bodyBuilder_; - } - @Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:Payload) - } - - // @@protoc_insertion_point(class_scope:Payload) - private static final Payload DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Payload(); - } - - public static Payload getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @Override - public Payload parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Payload(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @Override - public Payload getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/PayloadOrBuilder.java b/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/PayloadOrBuilder.java deleted file mode 100644 index 7c4c530640..0000000000 --- a/eventmesh-runtime-v2/src/main/java/org/apache/eventmesh/runtime/rpc/PayloadOrBuilder.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.eventmesh.runtime.rpc;// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: event_mesh_admin_service.proto - -public interface PayloadOrBuilder extends - // @@protoc_insertion_point(interface_extends:Payload) - com.google.protobuf.MessageOrBuilder { - - /** - * .Metadata metadata = 2; - * @return Whether the metadata field is set. - */ - boolean hasMetadata(); - /** - * .Metadata metadata = 2; - * @return The metadata. - */ - Metadata getMetadata(); - /** - * .Metadata metadata = 2; - */ - MetadataOrBuilder getMetadataOrBuilder(); - - /** - * .google.protobuf.Any body = 3; - * @return Whether the body field is set. - */ - boolean hasBody(); - /** - * .google.protobuf.Any body = 3; - * @return The body. - */ - com.google.protobuf.Any getBody(); - /** - * .google.protobuf.Any body = 3; - */ - com.google.protobuf.AnyOrBuilder getBodyOrBuilder(); -} diff --git a/eventmesh-runtime-v2/src/main/proto/event_mesh_admin_service.proto b/eventmesh-runtime-v2/src/main/proto/event_mesh_admin_service.proto deleted file mode 100644 index 84b0ddf2ce..0000000000 --- a/eventmesh-runtime-v2/src/main/proto/event_mesh_admin_service.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax="proto3"; - -import "google/protobuf/any.proto"; - -option java_multiple_files=true; - -message Metadata { - string type = 3; - map headers = 7; -} - - -message Payload { - Metadata metadata = 2; - google.protobuf.Any body = 3; -} - -service AdminBiStreamService { - rpc invokeBiStream(stream Payload) returns (stream Payload){} -} - -service AdminService { - rpc invoke(Payload) returns (Payload){} -} - diff --git a/eventmesh-runtime-v2/src/main/resources/connector.yaml b/eventmesh-runtime-v2/src/main/resources/connector.yaml new file mode 100644 index 0000000000..bc7bc20756 --- /dev/null +++ b/eventmesh-runtime-v2/src/main/resources/connector.yaml @@ -0,0 +1,18 @@ +# +# 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. +# + +jobID: 1 diff --git a/eventmesh-runtime-v2/src/main/resources/runtime.yaml b/eventmesh-runtime-v2/src/main/resources/runtime.yaml index 28a3981e67..44c5f6f91f 100644 --- a/eventmesh-runtime-v2/src/main/resources/runtime.yaml +++ b/eventmesh-runtime-v2/src/main/resources/runtime.yaml @@ -15,6 +15,8 @@ # limitations under the License. # +componentType: CONNECTOR registryServerAddr: 127.0.0.1:8085 registryPluginType: nacos storagePluginType: memory +adminServiceName: eventmesh-admin diff --git a/settings.gradle b/settings.gradle index 32d2c2e261..3801d99754 100644 --- a/settings.gradle +++ b/settings.gradle @@ -55,6 +55,7 @@ include 'eventmesh-transformer' include 'eventmesh-openconnect:eventmesh-openconnect-java' include 'eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api' +include 'eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-admin' include 'eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-nacos' include 'eventmesh-connectors:eventmesh-connector-openfunction' @@ -77,6 +78,7 @@ include 'eventmesh-connectors:eventmesh-connector-wecom' include 'eventmesh-connectors:eventmesh-connector-slack' include 'eventmesh-connectors:eventmesh-connector-wechat' include 'eventmesh-connectors:eventmesh-connector-http' +include 'eventmesh-connectors:eventmesh-connector-canal' include 'eventmesh-storage-plugin:eventmesh-storage-api' include 'eventmesh-storage-plugin:eventmesh-storage-standalone'