Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. await context.Redeliver(TimeSpan.FromSeconds(5), (consumeCtx, sendCtx) => {
  2. if (consumeCtx.Headers.TryGetHeader("SenderApp", out object sender))
  3. {
  4. sendCtx.Headers.Set("SenderApp", sender);
  5. }
  6. }).ConfigureAwait(false);
  7.  
  8. protected Task ScheduleSend(Uri rabbitUri, double delay)
  9. {
  10. return GetBus().ScheduleSend<IProcessOrganisationUpdate>(
  11. rabbitUri,
  12. TimeSpan.FromSeconds(delay),
  13. _Data,
  14. new HeaderPipe(_SenderApp, 0));
  15. }
  16.  
  17. public class HeaderPipe : IPipe<SendContext>
  18. {
  19. private readonly byte _Priority;
  20. private readonly string _SenderApp;
  21.  
  22. public HeaderPipe (byte priority)
  23. {
  24. _Priority = priority;
  25. _SenderApp = Assembly.GetEntryAssembly()?.GetName()?.Name ?? "Default";
  26. }
  27.  
  28. public HeaderPipe (string senderApp, byte priority)
  29. {
  30. _Priority = priority;
  31. _SenderApp = senderApp;
  32. }
  33.  
  34. public void Probe (ProbeContext context)
  35. { }
  36.  
  37. public Task Send (SendContext context)
  38. {
  39. context.Headers.Set("SenderApp", _SenderApp);
  40. context.SetPriority(_Priority);
  41. return Task.CompletedTask;
  42. }
  43. }
  44.  
  45. Initial trigger checking returns true for FinQuest.Robots.OrganisationLinkedinFeed (id: 001ae487-ad3d-4619-8d34-367881ec91ba, sender: FinQuest.Robot.DBProcess, modif: LinkedIn)
  46.  
  47. Initial trigger checking returns true for FinQuest.Robots.OrganisationLinkedinFeed (id: 001ae487-ad3d-4619-8d34-367881ec91ba, sender: , modif: LinkedIn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement