= CommandSubscriber
: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.

Part of the _Publishing SPI_ . A component to receive xref:refguide:applib:index/services/command/Command.adoc[Command] s (with publishing enabled) that just completed.

== API

[source,java]
.CommandSubscriber.java
----
interface CommandSubscriber {
  void onReady(Command command)     // <.>
  void onStarted(Command command)     // <.>
  void onCompleted(Command command)     // <.>
}
----

<.> xref:#onReady_Command[onReady(Command)]
+
--
Notifies that the command will be published, and has transitioned to _org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#READY_ .
--
<.> xref:#onStarted_Command[onStarted(Command)]
+
--
Notifies that the command has started to execute, and has transitioned to _org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#STARTED_ .
--
<.> xref:#onCompleted_Command[onCompleted(Command)]
+
--
Notifies that the command has completed and has transitioned to _org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#COMPLETED_
--

== Members

[#onReady_Command]
=== onReady(Command)

Notifies that the command will be published, and has transitioned to _org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#READY_ .

This is an opportunity for implementations to process the command, for example to persist an initial representation of it.

[#onStarted_Command]
=== onStarted(Command)

Notifies that the command has started to execute, and has transitioned to _org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#STARTED_ .

This is an opportunity for implementations to process the command, for example to update any persisted representation of it.

[#onCompleted_Command]
=== onCompleted(Command)

Notifies that the command has completed and has transitioned to _org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#COMPLETED_

This is an opportunity for implementations to process the command, for example to update any persisted representations of it.

include::hooks/CommandSubscriber_010-implementation.adoc[]

include::hooks/CommandSubscriber_020-examples-and-usage.adoc[]
