Skip to content

Commit

Permalink
Merge pull request #729 from xlegalles/CleanUpCode1
Browse files Browse the repository at this point in the history
Reformat Client/API: use file-scope namespace and primary constructor
  • Loading branch information
ChrisKujawa authored Oct 24, 2024
2 parents 71bb43c + 1699e53 commit a5e3407
Show file tree
Hide file tree
Showing 12 changed files with 556 additions and 570 deletions.
15 changes: 6 additions & 9 deletions Client/Api/Responses/IPublishMessageResponse.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
namespace Zeebe.Client.Api.Responses
{
/// <summary>
/// Response for publishing a message.
/// </summary>
public interface IPublishMessageResponse
{
}
}
namespace Zeebe.Client.Api.Responses;

/// <summary>
/// Response for publishing a message.
/// </summary>
public interface IPublishMessageResponse;
15 changes: 6 additions & 9 deletions Client/Api/Responses/IResolveIncidentResponse.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
namespace Zeebe.Client.Api.Responses
{
/// <summary>
/// Response for an resolve incident request.
/// </summary>
public interface IResolveIncidentResponse
{
}
}
namespace Zeebe.Client.Api.Responses;

/// <summary>
/// Response for an resolve incident request.
/// </summary>
public interface IResolveIncidentResponse;
17 changes: 8 additions & 9 deletions Client/Api/Responses/ISetVariablesResponse.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
namespace Zeebe.Client.Api.Responses
namespace Zeebe.Client.Api.Responses;

/// <summary>
/// Response for an set variables request.
/// </summary>
public interface ISetVariablesResponse
{
/// <summary>
/// Response for an set variables request.
/// </summary>
public interface ISetVariablesResponse
{
/// <returns> The unique key of the command</returns>
long Key { get; }
}
/// <returns> The unique key of the command</returns>
long Key { get; }
}
15 changes: 6 additions & 9 deletions Client/Api/Responses/IThrowErrorResponse.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
namespace Zeebe.Client.Api.Responses
{
/// <summary>
/// Response for an throw error request.
/// </summary>
public interface IThrowErrorResponse
{
}
}
namespace Zeebe.Client.Api.Responses;

/// <summary>
/// Response for an throw error request.
/// </summary>
public interface IThrowErrorResponse;
25 changes: 12 additions & 13 deletions Client/Api/Responses/ITopology.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@
// limitations under the License.
using System.Collections.Generic;

namespace Zeebe.Client.Api.Responses
namespace Zeebe.Client.Api.Responses;

public interface ITopology
{
public interface ITopology
{
/// <returns>
/// All (known) brokers of the cluster
/// </returns>
IList<IBrokerInfo> Brokers { get; }
/// <returns>
/// All (known) brokers of the cluster
/// </returns>
IList<IBrokerInfo> Brokers { get; }

/// <returns>
/// The gateway version or 'lower then 0.23' if none was found.
/// </returns>
string GatewayVersion { get; }
}
}
/// <returns>
/// The gateway version or 'lower then 0.23' if none was found.
/// </returns>
string GatewayVersion { get; }
}
15 changes: 6 additions & 9 deletions Client/Api/Responses/IUpdateJobTimeoutResponse.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
namespace Zeebe.Client.Api.Responses
{
/// <summary>
/// Response for an update job timeout request.
/// </summary>
public interface IUpdateJobTimeoutResponse
{
}
}
namespace Zeebe.Client.Api.Responses;

/// <summary>
/// Response for an update job timeout request.
/// </summary>
public interface IUpdateJobTimeoutResponse;
13 changes: 6 additions & 7 deletions Client/Api/Responses/IUpdateRetriesResponse.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
namespace Zeebe.Client.Api.Responses
namespace Zeebe.Client.Api.Responses;

/// <summary>
/// Response for an update retries request.
/// </summary>
public interface IUpdateRetriesResponse
{
/// <summary>
/// Response for an update retries request.
/// </summary>
public interface IUpdateRetriesResponse
{
}
}
19 changes: 9 additions & 10 deletions Client/Api/Responses/PartitionBrokerRole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
// 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.
namespace Zeebe.Client.Api.Responses
namespace Zeebe.Client.Api.Responses;

/// <summary>
/// The RAFT role of the broker either LEADER or FOLLOWER.
/// </summary>
public enum PartitionBrokerRole
{
/// <summary>
/// The RAFT role of the broker either LEADER or FOLLOWER.
/// </summary>
public enum PartitionBrokerRole
{
LEADER,
FOLLOWER
}
}
LEADER,
FOLLOWER
}
189 changes: 94 additions & 95 deletions Client/Api/Worker/IJobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,104 +16,103 @@
using Zeebe.Client.Api.Commands;
using Zeebe.Client.Api.Responses;

namespace Zeebe.Client.Api.Worker
namespace Zeebe.Client.Api.Worker;

/// <summary>
/// A client with access to all job-related operation:
/// <list type="bullet">
/// <item>complete a job</item>
/// <item> mark a job as failed</item>
/// <item> update the retries of a job</item>
/// </list>
/// </summary>
public interface IJobClient
{
/// <summary>
/// A client with access to all job-related operation:
/// <list type="bullet">
/// <item>complete a job</item>
/// <item> mark a job as failed</item>
/// <item> update the retries of a job</item>
/// </list>
/// Command to complete a job.
/// </summary>
public interface IJobClient
{
/// <summary>
/// Command to complete a job.
/// </summary>
/// <example>
/// <code>
/// long jobKey = ..;
///
/// jobClient
/// .NewCompleteJobCommand(jobKey)
/// .Variables(json)
/// .Send();
/// </code>
/// </example>
///
/// <para>
/// The job is linked to a process instance, which means this command will complete the related
/// activity and continue the flow.
/// </para>
///
/// <param name="jobKey">the key which identifies the job</param>
/// <returns>a builder for the command</returns>
ICompleteJobCommandStep1 NewCompleteJobCommand(long jobKey);
/// <example>
/// <code>
/// long jobKey = ..;
///
/// jobClient
/// .NewCompleteJobCommand(jobKey)
/// .Variables(json)
/// .Send();
/// </code>
/// </example>
///
/// <para>
/// The job is linked to a process instance, which means this command will complete the related
/// activity and continue the flow.
/// </para>
///
/// <param name="jobKey">the key which identifies the job</param>
/// <returns>a builder for the command</returns>
ICompleteJobCommandStep1 NewCompleteJobCommand(long jobKey);

/// <summary>
/// Command to complete a job.
/// </summary>
///
/// <example>
/// <code>
/// IJob activatedJob = ..;
///
/// jobClient
/// .NewCompleteJobCommand(activatedJob)
/// .Variables(json)
/// .Send();
/// </code>
/// </example>
///
/// <para>
/// The job is linked to a process instance, which means this command will complete the related
/// activity and continue the flow.
/// </para>
///
/// <param name="activatedJob">the job, which should be completed</param>
/// <returns>a builder for the command</returns>
ICompleteJobCommandStep1 NewCompleteJobCommand(IJob activatedJob);
/// <summary>
/// Command to complete a job.
/// </summary>
///
/// <example>
/// <code>
/// IJob activatedJob = ..;
///
/// jobClient
/// .NewCompleteJobCommand(activatedJob)
/// .Variables(json)
/// .Send();
/// </code>
/// </example>
///
/// <para>
/// The job is linked to a process instance, which means this command will complete the related
/// activity and continue the flow.
/// </para>
///
/// <param name="activatedJob">the job, which should be completed</param>
/// <returns>a builder for the command</returns>
ICompleteJobCommandStep1 NewCompleteJobCommand(IJob activatedJob);

/// <summary>
/// Command to mark a job as failed.
/// </summary>
///
/// <example>
/// <code>
/// long jobKey = ..;
///
/// jobClient
/// .NewFailCommand(jobKey)
/// .Retries(3)
/// .Send();
/// </code>
/// </example>
///
/// <para>
/// If the given retries are greater than zero then this job will be picked up again by a job
/// worker. Otherwise, an incident is created for this job.
/// </para>
/// <param name="jobKey">the key which identifies the job</param>
/// <returns>a builder for the command</returns>
IFailJobCommandStep1 NewFailCommand(long jobKey);
/// <summary>
/// Command to mark a job as failed.
/// </summary>
///
/// <example>
/// <code>
/// long jobKey = ..;
///
/// jobClient
/// .NewFailCommand(jobKey)
/// .Retries(3)
/// .Send();
/// </code>
/// </example>
///
/// <para>
/// If the given retries are greater than zero then this job will be picked up again by a job
/// worker. Otherwise, an incident is created for this job.
/// </para>
/// <param name="jobKey">the key which identifies the job</param>
/// <returns>a builder for the command</returns>
IFailJobCommandStep1 NewFailCommand(long jobKey);

/// <summary>
/// Command to report a business error (i.e. non-technical) that occurs while processing a job.
/// </summary>
/// <example>
/// <code>
/// long jobKey = ...;
/// string code = ...;
/// jobClient
/// .NewThrowErrorCommand(jobKey)
/// .ErrorCode(code)
/// .ErrorMessage("Business error message")
/// .Send();
/// </code>
/// </example>
/// <param name="jobKey">the key which identifies the job</param>
/// <returns>a builder for the command</returns>
IThrowErrorCommandStep1 NewThrowErrorCommand(long jobKey);
}
}
/// <summary>
/// Command to report a business error (i.e. non-technical) that occurs while processing a job.
/// </summary>
/// <example>
/// <code>
/// long jobKey = ...;
/// string code = ...;
/// jobClient
/// .NewThrowErrorCommand(jobKey)
/// .ErrorCode(code)
/// .ErrorMessage("Business error message")
/// .Send();
/// </code>
/// </example>
/// <param name="jobKey">the key which identifies the job</param>
/// <returns>a builder for the command</returns>
IThrowErrorCommandStep1 NewThrowErrorCommand(long jobKey);
}
25 changes: 12 additions & 13 deletions Client/Api/Worker/IJobWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@
// limitations under the License.
using System;

namespace Zeebe.Client.Api.Worker
namespace Zeebe.Client.Api.Worker;

/// <summary>
/// Represents an job worker that performs jobs of a certain type. While a registration is
/// open, the worker continuously receives jobs from the broker and hands them to a registered
/// <see cref="JobHandler"/>.
/// </summary>
public interface IJobWorker : IDisposable
{
/// <summary>
/// Represents an job worker that performs jobs of a certain type. While a registration is
/// open, the worker continuously receives jobs from the broker and hands them to a registered
/// <see cref="JobHandler"/>.
/// </summary>
public interface IJobWorker : IDisposable
{
/// <returns>true if this registration is currently active and work items are being received for it</returns>
bool IsOpen();
/// <returns>true if this registration is currently active and work items are being received for it</returns>
bool IsOpen();

/// <returns>true if this registration is not open and is not in the process of opening or closing</returns>
bool IsClosed();
}
/// <returns>true if this registration is not open and is not in the process of opening or closing</returns>
bool IsClosed();
}
Loading

0 comments on commit a5e3407

Please sign in to comment.