This file contains hidden or 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
package main | |
// This is a super-quick example of how to set the socket options to allow port re-use for a single address/port on a host machine. | |
// This is most commonly used with things like hot reloads of configuration. | |
import ( | |
"context" | |
"log" | |
"net" | |
"syscall" |
This file contains hidden or 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
listen frontend-secure | |
mode tcp | |
bind :443 tfo ssl crt /etc/ssl/private/ | |
server forward-to-internal-via-pipe abns@haproxy-pipe send-proxy | |
bind-process 2-4 | |
frontend frontend-aggregate | |
bind abns@haproxy-pipe accept-proxy | |
bind-process 1 |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"time" | |
) | |
// the code below is loosely based upon: https://gist.github.com/tux21b/1218360 | |
// it is only safe on 64-bit CPUs. |
This file contains hidden or 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
### Keybase proof | |
I hereby claim: | |
* I am joliver on github. | |
* I am joliver (https://keybase.io/joliver) on keybase. | |
* I have a public key whose fingerprint is B834 EF94 BA73 68A1 C02B 48BD 9C02 4FBE AC5B 8FE9 | |
To claim this, I am signing this object: |
This file contains hidden or 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
public sealed class NServiceBusCommitDispatcher : IPublishMessages | |
{ | |
private const string AggregateIdKey = "AggregateId"; | |
private const string CommitVersionKey = "CommitVersion"; | |
private const string EventVersionKey = "EventVersion"; | |
private const string BusPrefixKey = "Bus."; | |
private readonly IBus bus; | |
public NServiceBusCommitDispatcher(IBus bus) | |
{ |
This file contains hidden or 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.Diagnostics; | |
using System.Linq; | |
using System.Transactions; | |
using Raven.Client; | |
using Raven.Client.Document; | |
using Raven.Client.Linq; | |
public class Program | |
{ |
This file contains hidden or 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
CREATE TABLE [dbo].[Messages] | |
( | |
[AggregateId] [uniqueidentifier] NOT NULL, | |
[Version] [int] NOT NULL CHECK ([Version] > 0), | |
[Inserted] [datetime] NOT NULL DEFAULT (GETUTCDATE()), | |
[Headers] [varbinary](max) NOT NULL, | |
[Payload] [varbinary](max) NOT NULL, | |
CONSTRAINT [PK_Messages] PRIMARY KEY CLUSTERED ([AggregateId], [Version]) | |
); |
This file contains hidden or 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
return EventStore.Wireup.Init() | |
.UsingSqlPersistence("EventStore") | |
.InitializeDatabaseSchema() | |
.UsingCustomSerializer(new JsonSerializer()) | |
.Compress() | |
.EncryptWith(EncryptionKey) | |
.UsingAsynchronousDispatcher() | |
.PublishTo(new DelegateMessagePublisher(DispatchCommit)) | |
.HandleExceptionsWith(DispatchErrorHandler) | |
.Build(); |
This file contains hidden or 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
public void Test() | |
{ | |
var serializer = new Newtonsoft.Json.JsonSerializer(); | |
using (var memoryStream = new MemoryStream()) | |
{ | |
using (var bsonWriter = new BsonWriter(memoryStream)) | |
serializer.Serialize(bsonWriter, 12345); | |
Console.Write("Stream length is: " + memoryStream.Length); // shouldn't be *0*! |
This file contains hidden or 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
namespace ConsoleApplication1 | |
{ | |
using System; | |
using System.Transactions; | |
using Raven.Client.Document; | |
public static class MainProgram | |
{ | |
private const string RavenUrl = "http://localhost:8080"; | |
private const string CustomDatabaseName = "MyDatabase"; |
NewerOlder