= BackgroundService
:Notice: 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.

Allows the execution of action invocations or property edits to be deferred so that they can be executed later in another thread of execution.

Typically this other thread of execution would be scheduled from quartz or similar. The _org.apache.causeway.extensions.commandlog.applib.job.RunBackgroundCommandsJob_ provides a ready-made implementation to do this for quartz.

== API

[source,java]
.BackgroundService.java
----
class BackgroundService {
  AsyncProxy<T> execute(T object)     // <.>
  AsyncProxy<T> executeSkipRules(T object)     // <.>
  AsyncProxy<T> executeMixin(Class<T> mixinClass, Object mixedIn)     // <.>
  AsyncProxy<T> executeMixinSkipRules(Class<T> mixinClass, Object mixedIn)     // <.>
  AsyncControl asyncControl()
}
----

<.> xref:#execute_T[execute(T)]
+
--
Wraps the domain object in a proxy whereby any actions invoked through the proxy will instead be persisted as a _ExecuteIn#BACKGROUND background_ xref:refguide:extensions:index/commandlog/applib/dom/CommandLogEntry.adoc[CommandLogEntry] .
--
<.> xref:#executeSkipRules_T[executeSkipRules(T)]
+
--
Wraps the domain object in a proxy whereby any actions invoked through the proxy will instead be persisted as a _ExecuteIn#BACKGROUND background_ xref:refguide:extensions:index/commandlog/applib/dom/CommandLogEntry.adoc[CommandLogEntry] .
--
<.> xref:#executeMixin_Class_Object[executeMixin(Class, Object)]
+
--
Wraps a mixin object in a proxy whereby invoking that mixin will instead be persisted as a _ExecuteIn#BACKGROUND background_ xref:refguide:extensions:index/commandlog/applib/dom/CommandLogEntry.adoc[CommandLogEntry] .
--
<.> xref:#executeMixinSkipRules_Class_Object[executeMixinSkipRules(Class, Object)]
+
--
Wraps a mixin object in a proxy whereby invoking that mixin will instead be persisted as a _ExecuteIn#BACKGROUND background_ xref:refguide:extensions:index/commandlog/applib/dom/CommandLogEntry.adoc[CommandLogEntry] .
--

== Members

[#execute_T]
=== execute(T)

Wraps the domain object in a proxy whereby any actions invoked through the proxy will instead be persisted as a _ExecuteIn#BACKGROUND background_ xref:refguide:extensions:index/commandlog/applib/dom/CommandLogEntry.adoc[CommandLogEntry] .

[#executeSkipRules_T]
=== executeSkipRules(T)

Wraps the domain object in a proxy whereby any actions invoked through the proxy will instead be persisted as a _ExecuteIn#BACKGROUND background_ xref:refguide:extensions:index/commandlog/applib/dom/CommandLogEntry.adoc[CommandLogEntry] .

[#executeMixin_Class_Object]
=== executeMixin(Class, Object)

Wraps a mixin object in a proxy whereby invoking that mixin will instead be persisted as a _ExecuteIn#BACKGROUND background_ xref:refguide:extensions:index/commandlog/applib/dom/CommandLogEntry.adoc[CommandLogEntry] .

[#executeMixinSkipRules_Class_Object]
=== executeMixinSkipRules(Class, Object)

Wraps a mixin object in a proxy whereby invoking that mixin will instead be persisted as a _ExecuteIn#BACKGROUND background_ xref:refguide:extensions:index/commandlog/applib/dom/CommandLogEntry.adoc[CommandLogEntry] .
