| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | #nullable enable |
| | | 4 | | |
| | | 5 | | namespace IceBox; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// The exception that is thrown when an IceBox service fails to start. |
| | | 9 | | /// </summary> |
| | | 10 | | /// <remarks>You can throw any exception from your implementation of <see cref="Service.start" />. This exception is |
| | | 11 | | /// provided for backward compatibility with earlier versions of IceBox.</remarks> |
| | | 12 | | public sealed class FailureException : Ice.LocalException |
| | | 13 | | { |
| | 0 | 14 | | public string reason => Message; |
| | | 15 | | |
| | | 16 | | public FailureException(string? message, System.Exception? innerException = null) |
| | 0 | 17 | | : base(message, innerException) |
| | | 18 | | { |
| | 0 | 19 | | } |
| | | 20 | | |
| | 0 | 21 | | public override string ice_id() => "::IceBox::FailureException"; |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Represents an IceBox service that you implement and that the IceBox service manager starts and later stops. |
| | | 26 | | /// The same service can be started and stopped multiple times. |
| | | 27 | | /// </summary> |
| | | 28 | | public interface Service |
| | | 29 | | { |
| | | 30 | | /// <summary> |
| | | 31 | | /// Starts the service. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <param name="name">The service's name, as specified in configuration.</param> |
| | | 34 | | /// <param name="communicator">A communicator for use by the service. The IceBox service manager creates this |
| | | 35 | | /// communicator when it starts, and destroys this communicator when it shuts down.</param> |
| | | 36 | | /// <param name="args">The service arguments that were not converted into properties of <paramref name="communicator |
| | | 37 | | void start(string name, Ice.Communicator communicator, string[] args); |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Stops the service. |
| | | 41 | | /// </summary> |
| | | 42 | | void stop(); |
| | | 43 | | } |