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

com.transferwise.tasks.entrypoints.EntryPointsService Maven / Gradle / Ivy

The newest version!
package com.transferwise.tasks.entrypoints;

import com.transferwise.common.context.TwContext;
import com.transferwise.common.context.UnitOfWorkManager;
import java.util.function.Supplier;
import org.springframework.beans.factory.annotation.Autowired;

public class EntryPointsService implements IEntryPointsService {

  @Autowired
  private UnitOfWorkManager unitOfWorkManager;

  @Override
  public  T continueOrCreate(String group, String name, Supplier supplier) {
    if (TwContext.current().isEntryPoint()) {
      return supplier.get();
    }

    return unitOfWorkManager.createEntryPoint(group, name).toContext().execute(supplier);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy