PakhomovAlexander commented on code in PR #3430: URL: https://github.com/apache/ignite-3/pull/3430#discussion_r1532293273
########## modules/eventlog/src/main/java/org/apache/ignite/internal/eventlog/event/IgniteEvents.java: ########## @@ -0,0 +1,56 @@ +/* + * 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.ignite.internal.eventlog.event; + +import java.util.Arrays; +import org.apache.ignite.internal.eventlog.api.Event; +import org.apache.ignite.internal.eventlog.api.EventFactory; + +/** + * The main class for creating all Ignite events. + * + * <p>If you want to create an instance of the Event with the specified type, use the {@link #create} method. + * + * <p>For example, to create an event of the type CONNECTION_ESTABLISHED: + * <pre>{@code IgniteEvents.CONNECTION_ESTABLISHED.create(EventUser.system());}</pre> + */ +public final class IgniteEvents implements EventFactory { + public static final IgniteEvents CONNECTION_ESTABLISHED = new IgniteEvents(IgniteEventTypes.CONNECTION_ESTABLISHED.name()); + + public static final IgniteEvents CONNECTION_CLOSED = new IgniteEvents(IgniteEventTypes.CONNECTION_CLOSED.name()); + + static { + Arrays.stream(IgniteEventTypes.values()).forEach(type -> EventTypeRegistry.register(type.name())); + } + + private final String type; + + private IgniteEvents(String type) { + this.type = type; + } + + @Override + public Event create(EventUser user) { + return Event.builder() + .type(type) + .user(user) + .timestamp(System.currentTimeMillis()) + .productVersion("3.0.0") Review Comment: yes, I have created a ticket for that. -- 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]
