Skip to content

Instantly share code, notes, and snippets.

@pablete
Created February 20, 2015 22:06
Show Gist options
  • Save pablete/69960fde45b5d79f938b to your computer and use it in GitHub Desktop.
Save pablete/69960fde45b5d79f938b to your computer and use it in GitHub Desktop.
public void Publish(IEnumerable<Reservation> reservations, out int nextWaterMark)
{
nextWaterMark = 0;
using (IRabbitMqClient client = _clientFactory())
{
var channel = client.GetChannel();
foreach (var reservation in reservations)
{
string routingKey = GetRoutingKey(reservation);
string jsonReservation = SerializetoJson(reservation);
byte[] messageBodyBytes = System.Text.Encoding.UTF8.GetBytes(jsonReservation);
IBasicProperties props = GetBasicProperties(channel, routingKey, client.OtReservationExchange);
channel.BasicPublish(client.OtReservationExchange, routingKey, false, false, props, messageBodyBytes);
Analytics.Client.Track(
reservation.gpId,
"reservation_made",
SerializetoDict(reservation);
new Options().SetAnonymousId(anonymousId));
ABclient.trackGoal(“reservation_made”, anonymousId); //anonymous unique visitor ID
nextWaterMark = reservation.reservationSequenceNumber;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment