All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.devonfw.module.kafka.common.messaging.retry.util.MessageRetryUtils Maven / Gradle / Ivy

There is a newer version: 2023.01.001
Show newest version
package com.devonfw.module.kafka.common.messaging.retry.util;

import java.util.HashSet;
import java.util.Set;

import com.devonfw.module.kafka.common.messaging.retry.api.client.MessageRetryOperations;

/**
 * An Utility class to support {@link MessageRetryOperations}.
 *
 * @deprecated The implementation of devon4j-kafka will be abandoned. It is superseeded by Springs Kafka
 *             implementation.
 */
@Deprecated
public class MessageRetryUtils {

  private MessageRetryUtils() {

  }

  /**
   * This method is used to get the retryable exceptions
   *
   * @param exceptionNames the {@link Set} of exceptions
   * @param propertyName the exception property name.
   * @return Set>.
   */
  @SuppressWarnings("unchecked")
  public static Set> getRetryableExceptions(Set exceptionNames,
      String propertyName) {

    Set> result = new HashSet<>();
    if (exceptionNames != null) {

      for (String className : exceptionNames) {

        try {
          result.add((Class) Class.forName(className));
        } catch (Exception e) {
          throw new IllegalArgumentException(
              "The property \"" + propertyName + "\"contains the" + "invalid exception \"" + className + "\"", e);
        }

      }
    }
    return result;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy