Interface IocJobLambda<S>

  • Type Parameters:
    S - Your service on which you want to call a background job method.
    All Superinterfaces:
    JobRunrJob, java.io.Serializable
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface IocJobLambda<S>
    extends JobRunrJob
    This is a functional interface which represents a lambda that will be parsed by JobRunr. You may not create an actual instance of this class, instead you use it as follows:
    
         BackgroundJob.<SomeService>enqueue(x -> x.doWork("some argument"))
     

    or

    
         jobScheduler.<SomeService>enqueue(x -> x.doWork("some argument"))
     

    This functional interface allows you to enqueue background jobs without having an actual instance available of your service. While processing, JobRunr will lookup the actual service in the IoC container or create a new instance using the default constructor.

    • Method Detail

      • accept

        void accept​(S service)
             throws java.lang.Exception
        Throws:
        java.lang.Exception