Skip to content

Instantly share code, notes, and snippets.

@kaos
Last active May 3, 2017 13:35
Show Gist options
  • Save kaos/09720c6838bbfb7b281a to your computer and use it in GitHub Desktop.
Save kaos/09720c6838bbfb7b281a to your computer and use it in GitHub Desktop.

Revisions

  1. kaos revised this gist May 14, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mq.capnp
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    # other errors in concept or layout with regard to how the queues and
    # topics work.

    interface MessageQueue {
    interface Broker {
    publish (message :Message, topic :Topic) -> (result :Result);
    subscribe (subscriber :Subscriber, topic :Topic) -> (result: Result);
    }
  2. kaos revised this gist May 14, 2014. 1 changed file with 15 additions and 3 deletions.
    18 changes: 15 additions & 3 deletions mq.capnp
    Original file line number Diff line number Diff line change
    @@ -5,8 +5,8 @@
    # topics work.

    interface MessageQueue {
    publish (message :Message, topic :Topic);
    subscribe (subscriber :Subscriber, topic :Topic);
    publish (message :Message, topic :Topic) -> (result :Result);
    subscribe (subscriber :Subscriber, topic :Topic) -> (result: Result);
    }

    struct Topic {
    @@ -24,5 +24,17 @@ struct Message {
    }

    interface Subscriber {
    handle_message (message :Message, topic :Topic);
    handle_message (message :Message, topic :Topic) -> (result: Result);
    }

    struct Result {
    union {
    ok :Void; # all ok
    failed :Failure;
    # ... other results?
    }

    struct Failure {
    # define failures here..
    }
    }
  3. kaos created this gist May 14, 2014.
    28 changes: 28 additions & 0 deletions mq.capnp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    @0xe425876d9fb9589c

    # Disclaimer, I'm no pubsub expert, so there may be inconsitencies and
    # other errors in concept or layout with regard to how the queues and
    # topics work.

    interface MessageQueue {
    publish (message :Message, topic :Topic);
    subscribe (subscriber :Subscriber, topic :Topic);
    }

    struct Topic {
    id :Text;
    # ...?
    }

    struct Message {
    # from: Id; ?
    union {
    text :Text;
    data :Data;
    # ...
    }
    }

    interface Subscriber {
    handle_message (message :Message, topic :Topic);
    }