Skip to content

Commit

Permalink
Enable stream-stype serialization for Java Communication Job Router (A…
Browse files Browse the repository at this point in the history
  • Loading branch information
alzimmermsft authored and markcowl committed Jun 7, 2024
1 parent a6d3598 commit 699b42a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 51 deletions.
53 changes: 4 additions & 49 deletions specification/communication/Communication.JobRouter/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ union WorkerSelectorAttachmentKind {
weightedAllocation: "weightedAllocation",
}

@clientName("ClassificationPolicyInternal", "java")
@resource("routing/classificationPolicies")
@doc("A container for the rules that govern how jobs are classified.")
model ClassificationPolicy {
Expand All @@ -380,7 +379,6 @@ model ClassificationPolicy {
workerSelectorAttachments?: WorkerSelectorAttachment[];
}

@clientName("RouterRuleInternal", "java")
@doc("""
A rule of one of the following types:
StaticRule: A rule providing static rules that always return the same result, regardless of input.
Expand All @@ -395,7 +393,6 @@ model RouterRule {
kind: RouterRuleKind;
}

@clientName("DistributionPolicyInternal", "java")
@resource("routing/distributionPolicies")
@doc("Policy governing how jobs are distributed to workers")
model DistributionPolicy {
Expand All @@ -416,7 +413,6 @@ model DistributionPolicy {
mode?: DistributionMode;
}

@clientName("DistributionModeInternal", "java")
@doc("Abstract base class for defining a distribution mode.")
@discriminator("kind")
model DistributionMode {
Expand All @@ -433,7 +429,6 @@ model DistributionMode {
kind: DistributionModeKind;
}

@clientName("ExceptionPolicyInternal", "java")
@resource("routing/exceptionPolicies")
@doc("A policy that defines actions to execute when exception are triggered.")
model ExceptionPolicy {
Expand All @@ -451,7 +446,6 @@ model ExceptionPolicy {
exceptionRules?: ExceptionRule[];
}

@clientName("ExceptionRuleInternal", "java")
@doc("A rule that defines actions to execute upon a specific trigger.")
model ExceptionRule {
@doc("Id of an exception rule.")
Expand All @@ -464,7 +458,6 @@ model ExceptionRule {
actions: ExceptionAction[];
}

@clientName("ExceptionTriggerInternal", "java")
@doc("Abstract base class for defining a trigger for exception rules.")
@discriminator("kind")
model ExceptionTrigger {
Expand All @@ -481,7 +474,6 @@ model RouterJobNote {
addedAt?: utcDateTime;
}

@clientName("RouterJobInternal", "java")
@resource("routing/jobs")
@doc("A unit of work to be routed")
model RouterJob {
Expand Down Expand Up @@ -548,7 +540,6 @@ model RouterJob {
matchingMode?: JobMatchingMode;
}

@clientName("RouterWorkerSelectorInternal", "java")
@doc("Describes a condition that must be met against a set of labels for worker selection.")
model RouterWorkerSelector {
@doc("The label key to query against.")
Expand Down Expand Up @@ -598,7 +589,6 @@ model RouterJobAssignment {
closedAt?: utcDateTime;
}

@clientName("JobMatchingModeInternal", "java")
@doc("""
A matching mode of one of the following types:
QueueAndMatchMode: Used when matching worker to a job is required to be done right after job is queued.
Expand All @@ -611,7 +601,6 @@ model JobMatchingMode {
kind: JobMatchingModeKind;
}

@clientName("ScheduleAndSuspendModeInternal", "java")
@doc("Describes a matching mode used for scheduling jobs to be queued at a future time. At the specified time, matching worker to a job will not start automatically.")
model ScheduleAndSuspendMode extends JobMatchingMode {
@doc("Requested schedule time.")
Expand All @@ -621,22 +610,20 @@ model ScheduleAndSuspendMode extends JobMatchingMode {
kind: JobMatchingModeKind.scheduleAndSuspend;
}

@clientName("QueueAndMatchModeInternal", "java")
@doc("Describes a matching mode where matching worker to a job is automatically started after job is queued successfully.")
model QueueAndMatchMode extends JobMatchingMode {
@doc("The type discriminator describing QueueAndMatchMode")
kind: JobMatchingModeKind.queueAndMatch;
}

@clientName("SuspendModeInternal", "java")
@doc("Describes a matching mode where matching worker to a job is suspended.")
model SuspendMode extends JobMatchingMode {
@doc("The type discriminator describing SuspendMode")
kind: JobMatchingModeKind.suspend;
}

@clientName("CancelJobOptionsInternal", "java")
@access(Access.public, "python")
@access(Access.public, "java")
@doc("Request payload for cancelling a job.")
model CancelJobOptions {
@doc("A note that will be appended to a job's Notes collection with the current timestamp.")
Expand All @@ -646,16 +633,16 @@ model CancelJobOptions {
dispositionCode?: string;
}

@clientName("CompleteJobOptionsInternal", "java")
@access(Access.public, "python")
@access(Access.public, "java")
@doc("Request payload for completing jobs.")
model CompleteJobOptions {
@doc("A note that will be appended to a job's Notes collection with the current timestamp.")
note?: string;
}

@clientName("CloseJobOptionsInternal", "java")
@access(Access.public, "python")
@access(Access.public, "java")
@doc("Request payload for closing jobs")
model CloseJobOptions {
@doc("Indicates the outcome of a job, populate this field with your own custom values.")
Expand Down Expand Up @@ -713,15 +700,14 @@ model AcceptJobOfferResult {
workerId: string;
}

@clientName("DeclineJobOfferOptionsInternal", "java")
@access(Access.public, "python")
@access(Access.public, "java")
@doc("Request payload for declining offers.")
model DeclineJobOfferOptions {
@doc("If the RetryOfferAt is not provided, then this job will not be offered again to the worker who declined this job unless the worker is de-registered and re-registered. If a RetryOfferAt time is provided, then the job will be re-matched to eligible workers at the retry time in UTC. The worker that declined the job will also be eligible for the job at that time.")
retryOfferAt?: utcDateTime;
}

@clientName("RouterQueueInternal", "java")
@resource("routing/queues")
@doc("A queue that can contain jobs to be routed.")
model RouterQueue {
Expand All @@ -746,7 +732,6 @@ model RouterQueue {
exceptionPolicyId?: string;
}

@clientName("RouterQueueStatisticsInternal", "java")
@doc("Statistics for the queue.")
model RouterQueueStatistics {
@doc("Id of the queue these details are about.")
Expand All @@ -762,7 +747,6 @@ model RouterQueueStatistics {
longestJobWaitTimeMinutes?: float64;
}

@clientName("RouterWorkerInternal", "java")
@resource("routing/workers")
@doc("An entity for jobs to be routed to.")
model RouterWorker {
Expand Down Expand Up @@ -863,7 +847,6 @@ model RouterWorkerAssignment {
assignedAt: utcDateTime;
}

@clientName("BestWorkerModeInternal", "java")
@doc("Jobs are distributed to the worker with the strongest abilities available.")
model BestWorkerMode extends DistributionMode {
@doc("Define a scoring rule to use, when calculating a score to determine the best worker. If not set, will use a default scoring formula that uses the number of job labels that the worker labels match, as well as the number of label selectors the worker labels match and/or exceed using a logistic function (https://en.wikipedia.org/wiki/Logistic_function).")
Expand Down Expand Up @@ -894,7 +877,6 @@ model ScoringRuleOptions {
descendingOrder?: boolean = true;
}

@clientName("CancelExceptionActionInternal", "java")
@doc("An action that marks a job as cancelled.")
model CancelExceptionAction extends ExceptionAction {
@doc("A note that will be appended to a job's notes collection with the current timestamp.")
Expand All @@ -907,7 +889,6 @@ model CancelExceptionAction extends ExceptionAction {
kind: ExceptionActionKind.cancel;
}

@clientName("ExceptionActionInternal", "java")
@doc("The action to take when the exception is triggered.")
@discriminator("kind")
model ExceptionAction {
Expand All @@ -918,7 +899,6 @@ model ExceptionAction {
kind: ExceptionActionKind;
}

@clientName("ConditionalQueueSelectorAttachmentInternal", "java")
@doc("Describes a set of queue selectors that will be attached if the given condition resolves to true.")
model ConditionalQueueSelectorAttachment extends QueueSelectorAttachment {
@doc("The condition that must be true for the queue selectors to be attached.")
Expand All @@ -931,7 +911,6 @@ model ConditionalQueueSelectorAttachment extends QueueSelectorAttachment {
kind: QueueSelectorAttachmentKind.conditional;
}

@clientName("RouterQueueSelectorInternal", "java")
@doc("Describes a condition that must be met against a set of labels for queue selection.")
model RouterQueueSelector {
@doc("The label key to query against.")
Expand All @@ -945,15 +924,13 @@ model RouterQueueSelector {
value?: unknown;
}

@clientName("QueueSelectorAttachmentInternal", "java")
@doc("An attachment of queue selectors to resolve a queue to a job from a classification policy.")
@discriminator("kind")
model QueueSelectorAttachment {
@doc("The type discriminator describing a sub-type of QueueSelectorAttachment.")
kind: QueueSelectorAttachmentKind;
}

@clientName("ConditionalWorkerSelectorAttachmentInternal", "java")
@doc("Describes a set of worker selectors that will be attached if the given condition resolves to true.")
model ConditionalWorkerSelectorAttachment extends WorkerSelectorAttachment {
@doc("The condition that must be true for the worker selectors to be attached.")
Expand All @@ -966,22 +943,19 @@ model ConditionalWorkerSelectorAttachment extends WorkerSelectorAttachment {
kind: WorkerSelectorAttachmentKind.conditional;
}

@clientName("WorkerSelectorAttachmentInternal", "java")
@doc("An attachment which attaches worker selectors to a job.")
@discriminator("kind")
model WorkerSelectorAttachment {
@doc("The type discriminator describing a sub-type of WorkerSelectorAttachment.")
kind: WorkerSelectorAttachmentKind;
}

@clientName("DirectMapRouterRuleInternal", "java")
@doc("A rule that return the same labels as the input labels.")
model DirectMapRouterRule extends RouterRule {
@doc("The type discriminator describing a sub-type of Rule.")
kind: RouterRuleKind.directMap;
}

@clientName("ExpressionRouterRuleInternal", "java")
@doc("A rule providing inline expression rules.")
model ExpressionRouterRule extends RouterRule {
@doc("The expression language to compile to and execute.")
Expand All @@ -994,7 +968,6 @@ model ExpressionRouterRule extends RouterRule {
kind: RouterRuleKind.expression;
}

@clientName("FunctionRouterRuleInternal", "java")
@doc("A rule providing a binding to an HTTP Triggered Azure Function.")
model FunctionRouterRule extends RouterRule {
@doc("URL for Azure Function.")
Expand All @@ -1019,14 +992,12 @@ model FunctionRouterRuleCredential {
clientId?: string;
}

@clientName("LongestIdleModeInternal", "java")
@doc("Jobs are directed to the worker who has been idle longest.")
model LongestIdleMode extends DistributionMode {
@doc("The type discriminator describing a sub-type of Mode.")
kind: DistributionModeKind.longestIdle;
}

@clientName("ManualReclassifyExceptionActionInternal", "java")
@doc("An action that manually reclassifies a job by providing the queue, priority and worker selectors.")
model ManualReclassifyExceptionAction extends ExceptionAction {
@doc("Updated QueueId.")
Expand All @@ -1052,7 +1023,6 @@ model OAuth2WebhookClientCredential {
clientSecret?: string;
}

@clientName("PassThroughQueueSelectorAttachmentInternal", "java")
@doc("Attaches a queue selector where the value is passed through from a job's label with the same key.")
model PassThroughQueueSelectorAttachment extends QueueSelectorAttachment {
@doc("The label key to query against.")
Expand All @@ -1065,7 +1035,6 @@ model PassThroughQueueSelectorAttachment extends QueueSelectorAttachment {
kind: QueueSelectorAttachmentKind.passThrough;
}

@clientName("PassThroughWorkerSelectorAttachmentInternal", "java")
@doc("Attaches a worker selector where the value is passed through from a job's label with the same key.")
model PassThroughWorkerSelectorAttachment extends WorkerSelectorAttachment {
@doc("The label key to query against.")
Expand All @@ -1081,7 +1050,6 @@ model PassThroughWorkerSelectorAttachment extends WorkerSelectorAttachment {
kind: WorkerSelectorAttachmentKind.passThrough;
}

@clientName("QueueLengthExceptionTriggerInternal", "java")
@doc("Trigger for an exception action on exceeding queue length.")
model QueueLengthExceptionTrigger extends ExceptionTrigger {
@doc("Threshold of number of jobs ahead in the queue to for this trigger to fire.")
Expand All @@ -1091,7 +1059,6 @@ model QueueLengthExceptionTrigger extends ExceptionTrigger {
kind: ExceptionTriggerKind.queueLength;
}

@clientName("QueueWeightedAllocationInternal", "java")
@doc("Contains the weight percentage and queue selectors to be applied if selected for weighted distributions.")
model QueueWeightedAllocation {
@doc("The percentage of this weight, expressed as a fraction of 1.")
Expand All @@ -1101,7 +1068,6 @@ model QueueWeightedAllocation {
queueSelectors: RouterQueueSelector[];
}

@clientName("ReclassifyExceptionActionInternal", "java")
@doc("An action that modifies labels on a job and then reclassifies it.")
model ReclassifyExceptionAction extends ExceptionAction {
@doc("The new classification policy that will determine queue, priority and worker selectors.")
Expand All @@ -1115,14 +1081,12 @@ model ReclassifyExceptionAction extends ExceptionAction {
kind: ExceptionActionKind.reclassify;
}

@clientName("RoundRobinModeInternal", "java")
@doc("Jobs are distributed in order to workers, starting with the worker that is after the last worker to receive a job.")
model RoundRobinMode extends DistributionMode {
@doc("The type discriminator describing a sub-type of Mode.")
kind: DistributionModeKind.roundRobin;
}

@clientName("RuleEngineQueueSelectorAttachmentInternal", "java")
@doc("Attaches queue selectors to a job when the RouterRule is resolved.")
model RuleEngineQueueSelectorAttachment extends QueueSelectorAttachment {
@doc("A RouterRule that resolves a collection of queue selectors to attach.")
Expand All @@ -1132,7 +1096,6 @@ model RuleEngineQueueSelectorAttachment extends QueueSelectorAttachment {
kind: QueueSelectorAttachmentKind.ruleEngine;
}

@clientName("RuleEngineWorkerSelectorAttachmentInternal", "java")
@doc("Attaches worker selectors to a job when a RouterRule is resolved.")
model RuleEngineWorkerSelectorAttachment extends WorkerSelectorAttachment {
@doc("A RouterRule that resolves a collection of worker selectors to attach.")
Expand All @@ -1142,7 +1105,6 @@ model RuleEngineWorkerSelectorAttachment extends WorkerSelectorAttachment {
kind: WorkerSelectorAttachmentKind.ruleEngine;
}

@clientName("StaticQueueSelectorAttachmentInternal", "java")
@doc("Describes a queue selector that will be attached to a job.")
model StaticQueueSelectorAttachment extends QueueSelectorAttachment {
@doc("The queue selector to attach.")
Expand All @@ -1152,7 +1114,6 @@ model StaticQueueSelectorAttachment extends QueueSelectorAttachment {
kind: QueueSelectorAttachmentKind.static;
}

@clientName("StaticRouterRuleInternal", "java")
@doc("A rule providing static rules that always return the same result, regardless of input.")
model StaticRouterRule extends RouterRule {
#suppress "@azure-tools/typespec-azure-core/no-unknown" "Unions are currently not allowed in spec."
Expand All @@ -1163,7 +1124,6 @@ model StaticRouterRule extends RouterRule {
kind: RouterRuleKind.static;
}

@clientName("StaticWorkerSelectorAttachmentInternal", "java")
@doc("Describes a worker selector that will be attached to a job.")
model StaticWorkerSelectorAttachment extends WorkerSelectorAttachment {
@doc("The worker selector to attach.")
Expand All @@ -1173,7 +1133,6 @@ model StaticWorkerSelectorAttachment extends WorkerSelectorAttachment {
kind: WorkerSelectorAttachmentKind.static;
}

@clientName("WaitTimeExceptionTriggerInternal", "java")
@doc("Trigger for an exception action on exceeding wait time.")
model WaitTimeExceptionTrigger extends ExceptionTrigger {
@doc("Threshold for wait time for this trigger.")
Expand All @@ -1183,7 +1142,6 @@ model WaitTimeExceptionTrigger extends ExceptionTrigger {
kind: ExceptionTriggerKind.waitTime;
}

@clientName("WebhookRouterRuleInternal", "java")
@doc("A rule providing a binding to an external web server.")
model WebhookRouterRule extends RouterRule {
@doc("Uri for Authorization Server.")
Expand All @@ -1199,7 +1157,6 @@ model WebhookRouterRule extends RouterRule {
kind: RouterRuleKind.webhook;
}

@clientName("WeightedAllocationQueueSelectorAttachmentInternal", "java")
@doc("Describes multiple sets of queue selectors, of which one will be selected and attached according to a weighting.")
model WeightedAllocationQueueSelectorAttachment
extends QueueSelectorAttachment {
Expand All @@ -1210,7 +1167,6 @@ model WeightedAllocationQueueSelectorAttachment
kind: QueueSelectorAttachmentKind.weightedAllocation;
}

@clientName("WeightedAllocationWorkerSelectorAttachmentInternal", "java")
@doc("Describes multiple sets of worker selectors, of which one will be selected and attached according to a weighting.")
model WeightedAllocationWorkerSelectorAttachment
extends WorkerSelectorAttachment {
Expand All @@ -1221,7 +1177,6 @@ model WeightedAllocationWorkerSelectorAttachment
kind: WorkerSelectorAttachmentKind.weightedAllocation;
}

@clientName("WorkerWeightedAllocationInternal", "java")
@doc("Contains the weight percentage and worker selectors to be applied if selected for weighted distributions.")
model WorkerWeightedAllocation {
@doc("The percentage of this weight, expressed as a fraction of 1.")
Expand Down
Loading

0 comments on commit 699b42a

Please sign in to comment.