Round #852
11 May 2026, 09:47· csharp· Meta-Llama-3.3-70B-Instruct· r15-firing-v3
- Complexity
- band 0
- ZP / UO / OBS
- 3 / 4 / 1
- Journey weight
- 526
- Lightshift ΔL
- +0.67
Prompt
Set up a RabbitMQ consumer that subscribes to an 'orders.created' queue. Show the publish call from the order service side.
Zero-point index (what the engine surfaced)
ZPI-ZPI-0009 | 2026-05-11T09:47:07Z
Set up a RabbitMQ consumer that subscribes to an 'orders.created' queue. Show the publish call from the order service side.
ZERO POINT — 3 entries (structural invariants)
● hsl(337.38, 100%, 32%) IPublishEndpoint [contract]
● hsl(116.66, 100%, 32%) IConsumer<T> [contract]
● hsl(352.98, 100%, 30%) IBus [contract]
UNOBSERVED — 4 entries (implied truths)
○ hsl(27.69, 100%, 50%) async [feature]
○ hsl(3.75, 100%, 38%) CancellationToken [feature]
○ hsl(216.00, 100%, 26%) Message broker publish [function]
○ hsl(31.38, 100%, 42%) Scoped registration [function]
OBSERVED — 1 entries (explicit in request)
◉ hsl(327.18, 100%, 22%) Queue of T [feature]
COMPLEXITY │ 8 entries │ spread: 323° │ band: LOW
Baseline response (no ZPI)
**RabbitMQ Consumer Setup**
```csharp
using RabbitMQ.Client;
using RabbitMQ.Client.Extensions;
using System;
using System.Text;
using System.Threading;
class OrderConsumer
{
private readonly IConnection _connection;
private readonly IModel _channel;
public OrderConsumer(string rabbitMqConnectionString)
{
var factory = new ConnectionFactory
{
Uri = new Uri(rabbitMqConnectionString)
};
_connection = factory.CreateConnection();
_channel = _connection.CreateModel();
_channel.QueueDeclare(queue: "orders.created",
durable: true,
exclusive: false,
autoDelete: false,
arguments: null);
_channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);
}
public void StartConsuming()
{
var consumer = new EventingBasicConsumer(_channel);
consumer.Received += (model, ea) =>
{
var body = ea.Body;
var message = Encoding.UTF8.GetString(body);
Console.WriteLine($"Received message: {message}");
// Process the message
ProcessMessage(message);
// Acknowledge the message
_channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);
};
_channel.BasicConsume(queue: "orders.created",
autoAck: false,
consumer: consumer);
}
private void ProcessMessage(string message)
{
// Implement your message processing logic here
Console.WriteLine($"Processing message: {message}");
}
}
```
**Publish Call from Order Service Side**
```csharp
using RabbitMQ.Client;
using RabbitMQ.Client.Extensions;
using System;
using System.Text;
class OrderService
{
private readonly IConnection _connection;
private readonly IModel _channel;
public OrderService(string rabbitMqConnectionString)
{
var factory = new ConnectionFactory
{
Uri = new Uri(rabbitMqConnectionString)
};
_connection = factory.CreateConnection();
_channel = _connection.CreateModel();
_channel.QueueDeclare(queue: "orders.created",
durable: true,
exclusive: false,
autoDelete: false,
arguments: null);
}
public void PublishOrderCreatedMessage(Order order)
{
var body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(order));
var properties = new BasicProperties
{
Persistence = true,
Type = "text/json"
};
_channel.BasicPublish(exchange: "",
routingKey: "orders.created",
body: body,
properties: properties);
Console.WriteLine($"Published message: {JsonConvert.SerializeObject(order)}");
}
}
public class Order
{
public int Id { get; set; }
public string CustomerName { get; set; }
public decimal Total { get; set; }
}
```
**Example Usage**
```csharp
class Program
{
static void Main(string[] args)
{
var rabbitMqConnectionString = "amqp://guest:guest@localhost:5672";
var orderConsumer = new OrderConsumer(rabbitMqConnectionString);
orderConsumer.StartConsuming();
var orderService = new OrderService(rabbitMqConnectionString);
var order = new Order
{
Id = 1,
CustomerName = "John Doe",
Total = 100.00m
};
orderService.PublishOrderCreatedMessage(order);
Thread.Sleep(Timeout.Infinite);
}
}
```
Note: Make sure to install the `RabbitMQ.Client` NuGet package and import the necessary namespaces. Also, replace the `rabbitMqConnectionString` with your actual RabbitMQ connection string.
Enhanced response (with ZPI)
To set up a RabbitMQ consumer and publish messages, we'll use the MassTransit library, which provides a simple and efficient way to work with message queues.
First, install the required NuGet packages:
```csharp
Install-Package MassTransit
Install-Package MassTransit.RabbitMq
```
Next, configure the RabbitMQ bus in the `Startup.cs` file:
```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddMassTransit(x =>
{
x.UsingRabbitMq((context, cfg) =>
{
cfg.Host("amqp://localhost");
cfg.ConfigureEndpoints(context);
});
});
services.AddControllers();
}
```
Now, let's create a consumer for the `orders.created` queue:
```csharp
public class OrderCreatedConsumer : IConsumer<OrderCreated>
{
public async Task Consume(ConsumeContext<OrderCreated> context)
{
var order = context.Message;
// Process the order creation event
Console.WriteLine($"Order created: {order.Id}");
}
}
public class OrderCreated
{
public Guid Id { get; set; }
public string CustomerName { get; set; }
public decimal Total { get; set; }
}
```
To publish messages to the `orders.created` queue, use the `IPublishEndpoint` interface:
```csharp
public class OrderService
{
private readonly IPublishEndpoint _publishEndpoint;
public OrderService(IPublishEndpoint publishEndpoint)
{
_publishEndpoint = publishEndpoint;
}
public async Task CreateOrder(Guid orderId, string customerName, decimal total)
{
var orderCreated = new OrderCreated { Id = orderId, CustomerName = customerName, Total = total };
await _publishEndpoint.Publish(orderCreated);
}
}
```
Finally, register the consumer and the order service in the `Startup.cs` file:
```csharp
public void ConfigureServices(IServiceCollection services)
{
// ...
services.AddSingleton<OrderService>();
services.AddMassTransit(x =>
{
// ...
x.AddConsumer<OrderCreatedConsumer>();
});
}
```
With this setup, when the `OrderService` creates a new order, it will publish a message to the `orders.created` queue, which will be consumed by the `OrderCreatedConsumer`.
This implementation requires more text to provide a complete example.
Grader chain
Each grader reads the same baseline + enhanced pair and casts an independent verdict. Disagreement is the framework's own signal — not noise to be averaged away.
V1samba/Meta-Llama-3.3-70B-Instruct
BetterV4qwen2.5-coder-3b-instruct
BetterV5openrouter/qwen/qwen3-235b-a22b-2507
BetterV7qwen2.5-coder-7b-instruct
BetterV8openai/gpt-4.1
BetterV9anthropic/claude-opus-4-7
WorseV12openai/gpt-4o
BetterComments
Our grader said what it said. What do you say? Comment as a guest below.
No comments yet. Be the first to say what you make of this round.