adutra commented on code in PR #922: URL: https://github.com/apache/polaris/pull/922#discussion_r1984672581
########## service/common/src/main/java/org/apache/polaris/service/events/PolarisEventListener.java: ########## @@ -0,0 +1,49 @@ +/* + * 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.polaris.service.events; + +/** + * Represents an event listener that can respond to notable moments during Polaris's execution. + * Users can either extend this interface and implement handlers for all events or, for ease, extend + * DefaultPolarisEventListener and only have to handle a subset of events. Event details are + * documented under the event objects themselves. + */ +public interface PolarisEventListener { Review Comment: My thoughts here: the API is this interface (`PolarisEventListener`), not `DefaultPolarisEventListener`. So if you add a new method here, and it's not a default method, even if it's implemented in `DefaultPolarisEventListener`, that would create a binary incompatible change. You cannot force implementors to extend `DefaultPolarisEventListener`. Instead, I would suggest making all methods in this interface default methods, with an empty body. This way, if more methods are added in the future, as long as they are default methods, that is not considered an API breaking change. > if I was maintaining a listener implementation and a new event type was added I would prefer that things fail at build time rather than have my listener silently ignore the new event Probably a matter of taste, but most implementors imho would be really angry at us if all of a sudden their implementation doesn't compile anymore, because they upgraded the Polaris version. This is something that should only happen during major upgrades. Imho it's really bad practice to force users to deal of compilation failures (trust me, that happened already on projects I used to work on, and the pushback was fierce). Also, if an event XYZ didn't exist at all in version N, and is introduced in version N+1, I personally think that it makes sense for existing implementations to start ignoring that event by default – since, conceptually speaking, that was exactly what they were doing already before the event was materialized by a new method. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
