NexJob.Trigger.GooglePubSub 6.7.0

dotnet add package NexJob.Trigger.GooglePubSub --version 6.7.0
                    
NuGet\Install-Package NexJob.Trigger.GooglePubSub -Version 6.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NexJob.Trigger.GooglePubSub" Version="6.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NexJob.Trigger.GooglePubSub" Version="6.7.0" />
                    
Directory.Packages.props
<PackageReference Include="NexJob.Trigger.GooglePubSub" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NexJob.Trigger.GooglePubSub --version 6.7.0
                    
#r "nuget: NexJob.Trigger.GooglePubSub, 6.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NexJob.Trigger.GooglePubSub@6.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NexJob.Trigger.GooglePubSub&version=6.7.0
                    
Install as a Cake Addin
#tool nuget:?package=NexJob.Trigger.GooglePubSub&version=6.7.0
                    
Install as a Cake Tool

NexJob.Trigger.GooglePubSub

Google Cloud Pub/Sub trigger for NexJob. Receives messages from a Pub/Sub subscription and automatically enqueues them as NexJob jobs.

Installation

dotnet add package NexJob.Trigger.GooglePubSub

Usage

Subscription Setup

using NexJob.Trigger.GooglePubSub;

builder.Services.AddNexJobGooglePubSubTrigger(options =>
{
    options.ProjectId = "my-gcp-project";
    options.SubscriptionId = "my-subscription";
    options.TargetQueue = "default";
});

Local Development with Pub/Sub Emulator

builder.Services.AddNexJobGooglePubSubTrigger(options =>
{
    options.ProjectId = "local-project";
    options.SubscriptionId = "local-subscription";
    options.EmulatorHost = "localhost:8085";
});

With EmulatorHost set, the trigger connects without TLS and without credentials. The repository tests the trigger against the real emulator image (gcr.io/google.com/cloudsdktool/cloud-sdk:emulators).

Strongly-Typed Consumer Registration

builder.Services.AddNexJobGooglePubSubTrigger<ProcessPubSubJob>(options =>
{
    options.ProjectId = "my-gcp-project";
    options.SubscriptionId = "my-subscription";
});

Operational Visibility

This trigger registers with IListenerRegistry to report live connection states (Starting, Listening, Faulted, Stopped) directly to the Dashboard /listeners page and the Cluster Pipeline Topology Map.


Configuration Options

Option Description Default
ProjectId Google Cloud Project ID (required) ""
SubscriptionId Pub/Sub Subscription ID (required) ""
TargetQueue Target NexJob queue name; "default" is the application's default queue ({prefix}.default) "default"
JobPriority Execution priority for enqueued jobs JobPriority.Normal
EmulatorHost Optional emulator endpoint (e.g. localhost:8085) null

Message Contract

The trigger expects messages with the following properties:

  • Data: The job input payload as a UTF-8 string (JSON).
  • Attributes:
    • nexjob.job_type: Assembly-qualified name of the job implementation type. Optional when the subscriber sets options.JobType or registers the trigger with AddNexJobGooglePubSubTrigger<TJob>(); the configured JobType always wins when both are present — a publisher cannot override it. A message with neither can never become a job: it is nacked after a 2 second pause (so it is not redelivered in a tight loop) and logged as an error. Pub/Sub delivers a nacked message again, so give the subscription a dead-letter policy (a dead-letter topic with a maximum number of delivery attempts) to park such messages instead of redelivering them forever.
    • traceparent: W3C traceparent header for distributed tracing (optional).

Broker Guarantees

This trigger satisfies all canonical NexJob trigger guarantees:

  1. At-least-once delivery — messages are delivered via pull subscription and acknowledged only after successful enqueue.
  2. Explicit Ack / Nack — returns SubscriberClient.Reply.Ack strictly after IScheduler.EnqueueAsync completes. On enqueue failure, returns SubscriberClient.Reply.Nack to allow reprocessing.
  3. Trace propagation — extracts W3C traceparent from message attributes and assigns it to JobRecord.TraceParent.
  4. Idempotency — uses native Pub/Sub MessageId as the JobRecord.IdempotencyKey.
  5. Graceful shutdown — respects cancellation token during host shutdown, nacking any in-flight messages so they can be picked up after restart.

Publishing Example

var publisher = await PublisherClient.CreateAsync(TopicName.FromProjectTopic("my-gcp-project", "my-topic"));

var message = new PubsubMessage
{
    Data = ByteString.CopyFromUtf8(jsonPayload),
    Attributes =
    {
        ["nexjob.job_type"] = typeof(OrderProcessingJob).AssemblyQualifiedName,
        ["traceparent"] = Activity.Current?.Id ?? string.Empty,
    },
};

await publisher.PublishAsync(message);
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.7.0 78 10/19/2026
6.6.0 82 10/18/2026
6.5.1 90 10/17/2026
6.5.0 82 10/17/2026
6.4.0 90 10/16/2026
6.3.0 81 10/12/2026
6.2.1 87 10/11/2026
6.2.0 89 10/10/2026
6.1.0 88 10/10/2026
6.0.0 87 10/9/2026
5.10.0 89 10/8/2026
5.9.0 96 10/5/2026
5.8.0 104 10/4/2026
5.7.0 91 10/1/2026
5.6.2 92 10/1/2026
5.6.1 95 9/30/2026
5.6.0 90 9/30/2026
5.5.0 97 9/25/2026
5.4.1 92 9/24/2026
5.4.0 90 9/24/2026
Loading failed