Instantly share code, notes, and snippets.

Embed
What would you like to do?
EventStore HTTP API - Replaying Parked Message Queue with C# and HttpClient
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
namespace EventStoreHTTPSpike
{
class Program
{
static void Main(string[] args)
{
try
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://127.0.0.1:2113/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
var request = new HttpRequestMessage(HttpMethod.Post, "/subscriptions/{StreamName}/{GroupName}/replayParked");
var byteArray = Encoding.ASCII.GetBytes("admin:changeit");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
var response = client.SendAsync(request).Result;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment