com.github.brandtg.discovery.HelixServiceDiscoveryStateTransitionHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-helix Show documentation
Show all versions of dropwizard-helix Show documentation
Dropwizard integration for working with Apache Helix.
The newest version!
/**
* Copyright (C) 2015 Greg Brandt ([email protected])
*
* Licensed 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 com.github.brandtg.discovery;
import org.apache.helix.NotificationContext;
import org.apache.helix.api.TransitionHandler;
import org.apache.helix.model.Message;
import org.apache.helix.participant.statemachine.StateModelInfo;
import org.apache.helix.participant.statemachine.Transition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@StateModelInfo(states = "{'OFFLINE','ONLINE'}", initialState = "OFFINE")
public class HelixServiceDiscoveryStateTransitionHandler extends TransitionHandler {
private static final Logger LOG = LoggerFactory.getLogger(HelixServiceDiscoveryStateTransitionHandler.class);
@Transition(from = "OFFLINE", to = "ONLINE")
public void fromOfflineToOnline(Message message, NotificationContext context) {
LOG.info("From OFFLINE to ONLINE: {}", message.getPartitionName());
}
@Transition(from = "ONLINE", to = "OFFLINE")
public void fromOnlineToOffline(Message message, NotificationContext context) {
LOG.info("From ONLINE to OFFLINE: {}", message.getPartitionName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy