Created
March 1, 2018 17:01
-
-
Save JustLogic/0fab3ea6e8b9528677e89150577b4574 to your computer and use it in GitHub Desktop.
EventStore HTTP API - Replaying Parked Message Queue with C# and HttpClient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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