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
// RegisterTaskQ registers the taskq application and all its handler in the | |
// hive. | |
func RegisterTaskQ(h beehive.Hive) { | |
a := h.NewApp("taskq", beehive.Persistent(3)) | |
a.Handle(Enque{}, EnQHandler{}) | |
a.Handle(Deque{}, DeQHandler{}) | |
a.Handle(Ack{}, AckHandler{}) | |
a.Handle(Timeout{}, TimeoutHandler{ | |
ExpDur: 60 * time.Second, | |
}) |
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 the main listener. | |
lis, err := net.Listen("tcp", ":23456") | |
if err != nil { | |
log.Fatal(err) | |
} | |
// Create a cmux. | |
mux := cmux.New(lis) | |
// Match connections in order: |
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
/* | |
* | |
* Copyright 2015, Google Inc. | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are | |
* met: | |
* | |
* * Redistributions of source code must retain the above copyright |
OlderNewer