Rebus er ingen gåde

2,426 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,426
On SlideShare
0
From Embeds
0
Number of Embeds
1,586
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Rebus er ingen gåde

  1. 1. er  ingen  gåde.......   29.  august  2012  @  ANUG   Mogens  Heller  Grabe  
  2. 2. Agenda!•  Hvad er dit problem?!•  Hvordan kan det løses?!•  Rebus! ! ! Slides! !+ snak! !+ kode!
  3. 3. Mogens Heller Grabe! ! ! ! mhg@d60.dk! @mookid8000! http://mookid.dk/oncode!
  4. 4. Hvad er dit problem?!
  5. 5. For eksempel:!public class Køb : FinansielTransaktion{ public void Bogfør() { // (....) foreach(var d in Pantebrev.Debitorer) { d.TilmeldTilCprMatch(); d.InhentKreditstatus(); } foreach(var k in Pantebrev.Kauti(...)}
  6. 6. Long-lived transactions...!
  7. 7. begin tran! DoThis()! DoThat()!commit tran!
  8. 8. begin tran! DoThis()!commit tran! ?! begin tran! DoThat()!commit tran!
  9. 9. Async Reliable Messaging!
  10. 10. Messaging!
  11. 11. Reliable!
  12. 12. Async!
  13. 13. Windows FTW!!!!11!
  14. 14. Hvad er så det der 
“service bus” for noget?!
  15. 15. Køkultur!
  16. 16. Request/reply!
  17. 17. Publish/subscribe!
  18. 18. Process manager!
  19. 19. NServiceBus!
  20. 20. MassTransit
Rhino Service Bus!
  21. 21. hmmm...!
  22. 22. Rebus!•  Første mål:! –  Request/reply + publish/subscribe! –  Lavet efter NServiceBus-modellen! –  Bedre fejlbeskeder!
  23. 23. ~ 400 linjer!!!
  24. 24. Simpel og intuitivkonfigurationshistorie!
  25. 25. Få, velvalgte features!
  26. 26. Ingen doodleware!
  27. 27. Rebus Core kun afhængig af .NET 4 BCL!
  28. 28. Integration m. 3.partslibs viasmå, fokuserede assemblies!
  29. 29. De bedste fejlbeskeder!
  30. 30. Lav friktion!
  31. 31. Rebus!•  Version 0.19.6!•  Ikke længere ~ 400 linjer! ! !=> 1.0 !!
  32. 32. Rebus!•  Apache License v. 2!•  Kode på GitHub:
 http://github.com/mookid8000/Rebus !
  33. 33. Contributors!
  34. 34. Rebus!•  install-package rebus –pre!•  evt. via! –  rebus.castle.windsor! –  rebus.structuremap! –  rebus.mongodb! –  rebus.ravendb! –  rebus.log4net! –  (...)!
  35. 35. Eksempel!•  Lillebitte kommunikation mlm. 2 processer!
  36. 36. Message!public class DoStuff{ public DoStuff(string whatToDo) { WhatToDo = whatToDo; } public string WhatToDo { get; private set; }}
  37. 37. Handler!public class DoStuffHandler : IHandleMessages<DoStuff>{ public void Handle(DoStuff message) { // go ahead and do the stuff... }}
  38. 38. Konfiguration!new RebusBus(....whoa!!)
  39. 39. Konfiguration!var a = new FaveContainerAdapter(container);Configure.With(a) .Logging(l => l.Log4Net()) .Transport(t => t.UseMsmq(“input”, “error”)) .DetermineDestination(d => d.(....) .CreateBus() .Start();
  40. 40. Konfiguration!var busForEverydayUse = container.Resolve<IBus>();var busForCertainAdvancedTasks = container.Resolve<IAdvancedBus>();var messageContext = container.Resolve<IMessageContext>()
  41. 41. Den rigtige måde!// lav konfigurationstryl med// Configure.With(containerAdapter)...// og så:public class HomeController : Controller{ public HomeController(IBus bus) {...}}//... osv!
  42. 42. Eksempel!•  Et vaskeægte (kunstigt) integrationsscenarie!
  43. 43. Sagde han “saga”?!
  44. 44. Process manager!
  45. 45. Saga!public class IntegrationSaga : Saga<IntegrationSagaData>, IAmInitiatedBy<SomethingHappened>, IHandleMessages<VerifyComplete>{ public void Handle(SomethingHappened m) {...} public void Handle(VerifyComplete m) {...}}
  46. 46. Saga!IntegrationSaga:public override void ConfigureHowToFindSaga(){ Incoming<SomethingHappened>(s => s.Id) .CorrelatesWith(d => d.IdOfEvent); Incoming<VerifyComplete>(s => s.CorrId) .CorrelatesWith(d => d.CorrId);}
  47. 47. Saga!IntegrationSaga:public void Handle(SomethingHappened m){ bus.Send(new DoIntegrate(...)); bus.Defer(TimeSpan.FromMinutes(2), new VerifyComplete(corrId));}
  48. 48. Eksempel!•  Et vaskeægte (lidt mere ægte) integrationsscenarie!
  49. 49. Rebus’ venner!•  containers! –  Autofac! –  StructureMap! –  Castle Windsor! –  Unity! –  Ninject!
  50. 50. Rebus’ venner!•  logging! –  Log4net! –  NLog!
  51. 51. Rebus’ venner!•  persistence! –  SQL Server! –  MongoDB! –  RavenDB! –  XML J!
  52. 52. Rebus’ venner!•  transport! –  MSMQ! –  RabbitMQ(*)! –  AzureMQ(*)! (*) umodne!
  53. 53. Rebus’ venner!•  ofte inviteret til festen! –  Topshelf!
  54. 54. Extensibility!•  Grundlæggende! –  ISendMessages! –  IReceiveMessages! –  IActivateHandlers! –  IDetermineDestination! –  ISerializeMessages! –  IStoreSubscriptions! –  IStoreSagaData! –  IInspectHandlerPipeline! –  IErrorTracker!
  55. 55. Extensibility!•  Supplerende! –  IAdvancedBus! •  BeforeTransportMessage(bus, message)! •  AfterTransportMessage(bus, ex, message)! •  BeforeMessage(bus, message)! •  AfterMessage(bus, ex, message)! •  MessageSent(bus, dest, message)! •  PoisonMessage(bus, message)!
  56. 56. Hvad nu?!Battle-hardening! Distributør! Gateway! (+ det løse)
 !
  57. 57. https://github.com/mookid8000/Rebus/wiki !
  58. 58. Tak for opmærksomheden!! Mogens Heller Grabe! ! ! ! mhg@d60.dk! @mookid8000! http://mookid.dk/oncode!
  59. 59. Image credits!•  Lyserød pistol: http://www.desantisholster.com/desantis-blog/girl-meets-gun !•  Plastikkæder: http://www.stanchionwholesaler.com/products/chain/mc_000 !•  Trollface: http://www.thebuzzmedia.com/troll-face-high-resolution/ !•  Eat SOAP: http://narwhaler.com/img/b7/h/eat-soap-b7HC4R.jpg !•  Just soap: 
 http://kinlane-productions.s3.amazonaws.com/api-evangelist/soap.gif !

×