-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[trans to #10563][fix #9640] remove pulsar-client-admin-api dependency : pulsar-client-original
#10513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[trans to #10563][fix #9640] remove pulsar-client-admin-api dependency : pulsar-client-original
#10513
Changes from all commits
0f91214
01efe2e
0acd021
0d95b93
5080d06
c4cae81
ac0de19
ef5e2de
cabd2d0
4a7dc75
0baad59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,8 +19,11 @@ | |
| package org.apache.pulsar.client.admin.internal; | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver; | ||
| import com.fasterxml.jackson.databind.module.SimpleModule; | ||
| import javax.ws.rs.ext.ContextResolver; | ||
| import javax.ws.rs.ext.Provider; | ||
| import org.apache.pulsar.client.admin.OffloadProcessStatus; | ||
| import org.apache.pulsar.common.util.ObjectMapperFactory; | ||
|
|
||
| /** | ||
|
|
@@ -33,6 +36,20 @@ public class JacksonConfigurator implements ContextResolver<ObjectMapper> { | |
|
|
||
| public JacksonConfigurator() { | ||
| mapper = ObjectMapperFactory.create(); | ||
| setInterfaceDefaultMapperModule(); | ||
| } | ||
|
|
||
| private void setInterfaceDefaultMapperModule() { | ||
| SimpleModule module = new SimpleModule("InterfaceDefaultMapperModule"); | ||
|
|
||
| // we not specific @JsonDeserialize annotation in OffloadProcessStatus | ||
| // because we do not want to have jackson dependency in pulsar-client-admin-api | ||
| // In this case we use SimpleAbstractTypeResolver to map interfaces to impls | ||
| SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver(); | ||
| resolver.addMapping(OffloadProcessStatus.class, OffloadProcessStatusImpl.class); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @merlimat I have added a |
||
|
|
||
| module.setAbstractTypes(resolver); | ||
| mapper.registerModule(module); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /** | ||
| * 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.pulsar.client.admin.internal; | ||
|
|
||
| import org.apache.pulsar.client.admin.LongRunningProcessStatus; | ||
| import org.apache.pulsar.client.admin.OffloadProcessStatus; | ||
| import org.apache.pulsar.client.api.MessageId; | ||
| import org.apache.pulsar.client.impl.MessageIdImpl; | ||
|
|
||
| /** | ||
| * Status of offload process. | ||
| */ | ||
| public class OffloadProcessStatusImpl extends LongRunningProcessStatus implements OffloadProcessStatus { | ||
| public MessageIdImpl firstUnoffloadedMessage; | ||
|
|
||
| public OffloadProcessStatusImpl() { | ||
| status = Status.NOT_RUN; | ||
| lastError = ""; | ||
| firstUnoffloadedMessage = (MessageIdImpl) MessageId.earliest; | ||
| } | ||
|
|
||
| public OffloadProcessStatusImpl(Status status, String lastError, | ||
| MessageId firstUnoffloadedMessage) { | ||
| this.status = status; | ||
| this.lastError = lastError; | ||
| this.firstUnoffloadedMessage = (MessageIdImpl) firstUnoffloadedMessage; | ||
| } | ||
|
|
||
| @Override | ||
| public MessageId getFirstUnoffloadedMessage() { | ||
| return firstUnoffloadedMessage; | ||
| } | ||
|
|
||
| @Override | ||
| public String getLastError() { | ||
| return lastError; | ||
| } | ||
|
|
||
| @Override | ||
| public Status getStatus() { | ||
| return status; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,12 @@ | |
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>pulsar-client-original</artifactId> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need pulsar client explicitly for Kafka connector?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @merlimat I believe this is related to the conversion between pulsar's schema and kafka's schema. So kafka connector need
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, @freeznet is right. we need Schema Impl classes |
||
| <version>${project.version}</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-databind</artifactId> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if gson is not already a dependency imported by pulsar-client-original in 2.7.x I would like to not add it.
Users of pulsar-client-original already have Jackson and usually who uses pulsar-client-admin-api uses pulsar-client, so I would lean toward using only Jackson.
what's your plan for removing gson in a follow up patch ? this next patch will become a blocker for the 2.8 release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
gsonas the dependency is a temporary action, with removal ofpulsar-client-originalandpulsar-package-core,pulsar-client-admin-apiwill lose dependency ofgson, but we still have a lot of classes importgson, such aspulsar/pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Topics.java
Line 21 in 581fd5b
I do understand that the 2.8 release is in a hurry, but there are indeed many problems that need to be fixed one by one in order to achieve the ultimate goal. So the removal of
gsonwill be in a separate PR soon.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My problem was about "adding" gson, if it was not already there, so to me this is not a problem.
thanks for your clarification