Commit Graph

351 Commits

Author SHA1 Message Date
Asim Aslam
44b17b7e4b strip use of cmd 2019-06-03 19:07:09 +01:00
Asim Aslam
b42b6fa0fc Further consolidate the libraries 2019-06-03 18:44:43 +01:00
Asim Aslam
f80f0eb38e fix broken pipe error 2019-06-03 15:55:47 +01:00
Asim Aslam
4035ab5c7b Change go-log links 2019-05-31 00:38:05 +01:00
Asim Aslam
b4874806df Add util 2019-05-30 23:52:10 +01:00
Asim Aslam
9f037eafd2 fix waitgroup bug which crashes subscriber 2019-05-29 09:28:04 +01:00
magodo
ebc479ef2c Wait() option now accept *sync.WaitGroup
The original signature accept a boolean, and it feel like a little
verbose, since when people pass in this option, he/she always want to
pass a `true`.

Now if input `wg` is nil, it has same effect as passing `true` in
original code. Furthermore, if user want's finer grained control during
shutdown, one can pass in a predefined `wg`, so that server will wait
against it during shutdown.
2019-05-27 21:17:57 +08:00
lpxxn
7da6ff1c4b fix:# #476 need send error info 2019-05-27 13:14:31 +08:00
shu xian
fac42bc1a9 add AutoAck support for Server 2019-05-24 20:06:27 +08:00
a13cdfcc34 add RegisterCheck server option for internal health checks
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-05-15 15:34:34 +03:00
Asim Aslam
ca77773fbf fix json tag parsing 2019-03-19 00:21:25 +00:00
Asim Aslam
7db2912d90 add more verbose output 2019-02-15 17:20:09 +00:00
Asim Aslam
6819989195 change default name/version 2019-02-15 16:14:41 +00:00
Asim Aslam
31fc8df2ba add server request body 2019-02-04 13:13:03 +00:00
Asim Aslam
baf7de76bf Merge branch 'master' of github.com:micro/go-micro 2019-02-04 10:29:26 +00:00
Asim Aslam
31b6cad47b make copy before writing 2019-02-04 10:29:10 +00:00
kuangzhiqiang
6be205fd40
client close: rpc: unable to write error response
when client close notice: "rpc: unable to write error response..."
2019-02-03 19:12:13 +08:00
Asim Aslam
c03d935ffd fallback for 0.14.0 and older 2019-02-01 15:57:34 +00:00
Asim Aslam
e22fa01935 fix ticker 2019-01-24 16:08:04 +00:00
Asim Aslam
a5015692e3
Merge pull request #400 from micro/interval
Move RegisterInterval into the server
2019-01-24 13:55:05 +00:00
Asim Aslam
539b8c1a3b Move RegisterInterval into the server 2019-01-24 13:22:17 +00:00
Asim Aslam
67a738b504
Merge pull request #399 from unistack-org/master
add context to SubscriberOptions
2019-01-24 13:11:33 +00:00
ac1afea7fc add context to server.SubscriberOptions and broker.SubscribeOption
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-01-24 15:36:01 +03:00
Asim Aslam
8090f9968d Update headers to remove X- prefix 2019-01-24 10:11:02 +00:00
Asim Aslam
8a0d5f0489 log if we can't even respond 2019-01-22 13:55:04 +00:00
Asim Aslam
2ed676acf4 handle errors differently 2019-01-22 13:52:18 +00:00
Asim Aslam
d8ba18deff change logging 2019-01-22 12:18:33 +00:00
Asim Aslam
6468733d98 Use protocol from node metadata 2019-01-18 12:30:39 +00:00
Asim Aslam
9bd32645be Account for old target 2019-01-18 10:43:41 +00:00
Asim Aslam
f41be53ff8 Add ability to process legacy requests 2019-01-18 10:23:36 +00:00
Asim Aslam
2cd2258731 For the legacy 2019-01-18 10:12:57 +00:00
Asim Aslam
784a89b488 Allow bytes.Frame to be set to sent just bytes 2019-01-16 15:27:57 +00:00
Asim Aslam
00661f8a99 Clarify log message 2019-01-15 15:17:30 +00:00
Asim Aslam
e362466e8a use default router 2019-01-14 21:45:43 +00:00
Asim Aslam
c1d0237370 Add client response 2019-01-14 21:30:43 +00:00
Asim Aslam
c17d0fcc0f grpc request 2019-01-13 19:54:07 +00:00
Asim Aslam
e1bc240a14 Respond with error type 2019-01-13 12:15:35 +00:00
Asim Aslam
bfd341a269 Execute wrappers before router 2019-01-11 15:49:54 +00:00
Asim Aslam
36788487a7 set headers as appropriate 2019-01-11 13:44:47 +00:00
Asim Aslam
9adebfcf1e rename method to endpoint 2019-01-10 21:25:31 +00:00
Asim Aslam
6e0e4a684c Further crufting 2019-01-09 19:28:13 +00:00
Asim Aslam
873fc6d663 rewriting a lot 2019-01-09 19:11:47 +00:00
Asim Aslam
d004c9624b Add router modifications 2019-01-09 16:20:57 +00:00
Asim Aslam
ee380c6b7a reorder 2019-01-09 09:06:30 +00:00
Asim Aslam
7a1f735825 remove server codec 2019-01-09 09:02:30 +00:00
Asim Aslam
f46828be33 Add Router interface 2019-01-08 20:32:47 +00:00
Asim Aslam
4cb41721f1 further codec changes 2019-01-08 15:38:25 +00:00
Asim Aslam
216dbb771a rename requestHeader 2019-01-07 18:25:31 +00:00
Asim Aslam
c9963cb870 rename 2019-01-07 18:20:47 +00:00
Asim Aslam
9544058af3
Merge pull request #372 from micro/codec
Switch default codec and add default codec for server
2019-01-07 17:54:28 +00:00
Asim Aslam
c717af21ac Some router changes 2019-01-07 17:17:06 +00:00
Asim Aslam
46ece968d4 rename service to router 2019-01-07 14:44:40 +00:00
Asim Aslam
d179c971af Switch default codec and add default codec for server 2019-01-07 13:48:38 +00:00
Asim Aslam
5aeb28dfee Add error header 2019-01-07 09:11:36 +00:00
Asim Aslam
ed580204a8 Add grpc codec 2019-01-02 12:55:06 +00:00
Asim Aslam
e2623d8ef5 Make json/protobuf codecs 2018-12-31 22:01:16 +00:00
Asim Aslam
0d917bbf37 move location of handler 2018-11-26 14:51:42 +00:00
Asim Aslam
34ed5235a3 rename rpc codec 2018-11-23 20:05:31 +00:00
Shulhan
415fb3a730 all: replace "pborman/uuid" with "google/uuid"
Internally, "pborman/uuid.NewUUID()" is calling "google/uuid.New()"
that return nil when there is an error [1].

Both package use the same license.

[1] https://github.com/pborman/uuid/blob/master/version1.go#L17
2018-11-21 17:29:21 +07:00
Asim Aslam
172ffee8c3 add rpc package comments 2018-11-20 10:30:53 +00:00
Asim Aslam
e69413b763 add continue 2018-11-15 21:13:33 +00:00
Asim Aslam
45f18042b7 make accept loop 2018-11-15 19:55:13 +00:00
Asim Aslam
0672b051cc Add Local/Remote ip to metadata 2018-11-14 20:27:58 +00:00
Asim Aslam
c6a2c8de6c add local/remote to testsocket 2018-11-14 19:45:46 +00:00
Mikhail Grachev
25e6dcc9b6 Fix some linter issues 2018-11-13 11:57:42 +03:00
Asim Aslam
a56e97b47d Change waitgroup processing 2018-05-26 09:41:41 +01:00
Asim Aslam
c666558f8c make the broker/transport listen on new addr when stop/started with addr :0 2018-05-25 15:19:25 +01:00
Asim Aslam
b39ec4472c Return subscriber errors 2018-04-26 10:47:13 +01:00
Asim Aslam
0315b4480f revert some changes 2018-04-17 11:00:22 +01:00
Asim Aslam
19fdfba0bf move wrapper files 2018-04-14 19:24:17 +01:00
Asim Aslam
d00d76bf7c Move publication to message 2018-04-14 18:21:02 +01:00
Asim Aslam
65068e8b82 rename Streamer to Stream 2018-04-14 18:15:09 +01:00
Asim Aslam
e55437698b misc moved to util 2018-04-08 12:37:45 +01:00
Asim Aslam
c9b40cb33b switch to stdlib context 2018-03-03 11:53:52 +00:00
Tobias Wellnitz, DH1TW
0dcea05fb8 fix possible deadlock since code can return without unlocking the Mutex 2018-01-01 19:57:13 +01:00
Shannon Wynter
0e696f4907 Fix hashing of the service definition
Maps are sorted randomly, order the keys as a slice
2017-08-24 18:25:05 +10:00
Hao Lian
d4b149046f server/rpc_codec: if c.codec.Write fails, reset write buffer and encode an error message about the encoding failure
When developing go-micro services, it is frequently possible to set invalid results in the response pointer. When this happens (as I and @trushton personally experienced), `sendResponse()` returns an error correctly explaining what happened (e.g. protobuf refused to encode a bad struct) but the `call()` function one above it in the stack ignores the returned error object.

Thus, invalid structs go un-encoded and the _client side times out_. @trushton and I first caught this in our CI builds when we left a protobuf.Empty field uninitialized (nil) instead of setting it to `&ptypes.Empty{}`. This resulted in an `proto: oneof field has nil value` error, but it was dropped and became a terribly confusing client timeout instead.

This patch is two independent changes:

* In rpc_codec, when a serialization failure occurs serialize an error message, which will correctly become a 500 for HTTP services, about the encoding failure. This means rpc_codec only returns an `error` when a socket failure occurs, which I believe is the behavior that rpc_service is expecting anyway.

* In rpc_service, log any errors returned by sendResponse instead of dropping the error object. This will make debugging client timeouts less of a hassle.
2017-07-17 14:21:43 -04:00
Asim Aslam
3812cbbcb6 defer wg.Done so it's called even if there's a panic 2017-06-12 14:18:59 +01:00
Asim Aslam
e1a1f1c0f0 add wait option 2017-05-31 19:47:50 +01:00
Asim Aslam
f7a9207c7a wait for subscribers to complete 2017-05-31 19:47:41 +01:00
Asim Aslam
2ee22f5336 strip init of wg 2017-05-31 19:35:16 +01:00
Asim Aslam
276a0118da be pedantic 2017-05-31 19:33:11 +01:00
Asim Aslam
726793b6fa Wait for requests to finish before closing transport 2017-05-31 19:21:41 +01:00
Asim Aslam
a7312f5c7e log panics 2017-05-16 19:14:00 +01:00
Asim Aslam
5bce20627f Switch that back to Fatal since we've added the convenience method 2017-05-12 15:14:54 +01:00
Asim Aslam
bab586b71e make use of micro/go-log 2017-05-11 20:43:42 +01:00
Asim Aslam
238c99d228 rename file to please the OCD gods 2017-01-12 20:38:43 +00:00
Asim Aslam
a9889730d6 move addr extractor to misc 2017-01-12 13:20:34 +00:00
Asim Aslam
d606d00f35 superfluous logging 2016-12-15 20:45:27 +00:00
Asim Aslam
71d717a06d strip doc.go files 2016-12-14 15:41:48 +00:00
Asim
a36e042983 We don't need numcalls, save us a mutex lock 2016-11-01 19:40:36 +00:00
Asim
15f19b700f Use struct tags if available 2016-07-30 19:01:42 +01:00
Asim
739b094cd2 Merge branch 'master' into pool 2016-06-06 14:06:03 +01:00
Asim
93c1ae6221 Add debug stats handler 2016-05-28 22:30:47 +01:00
Asim
7a5a9013ef move the option 2016-05-26 20:43:05 +01:00
Asim
ee3ae89ca8 naming nitpick 2016-05-26 20:25:00 +01:00
Asim
8245390b5a Support endpoint metadata 2016-05-26 18:01:02 +01:00
Asim
1254a87286 Add package comments 2016-05-24 22:22:46 +01:00
Asim
2e9f4271a8 Pool first attempt 2016-05-13 15:58:53 +01:00
Asim
8c8573426c Add cascading timeouts 2016-05-12 23:32:58 +01:00
Asim
aea81315d0 Change QueueName to Queue 2016-05-10 10:55:18 +01:00
Asim
decb70b97c Response type for Stream is an interface 2016-04-26 15:52:08 +01:00
Asim
ca91a8383e Add mock server 2016-04-16 00:02:55 +01:00
Asim
bfe20d81d0 More linting fun 2016-04-06 18:03:27 +01:00
Asim
2f50c74f41 Satisfy the golint gods a little 2016-04-06 17:53:16 +01:00
Asim
fe4362be5a Merge pull request #57 from micro/log
remove use of glog
2016-03-15 20:56:11 +00:00
Asim
d1eae8fabe remove use of glog 2016-03-14 11:01:10 +00:00
Asim
71764564e7 Add packages for the defaults 2016-03-14 10:45:38 +00:00
Asim
1adcb237d9 Only log registering if not registered 2016-02-27 22:14:25 +00:00
Asim
8e61057bc9 Allow init of wrappers and name. Set server.name for rpc request 2016-02-18 18:08:43 +00:00
Asim
8cd906e75e Set TTL on first registration of http broker. Also dont resubscribe 2016-02-15 22:20:54 +00:00
Asim
6b7f2f3bd3 Merge pull request #45 from micro/metadata
Move context to metadata
2016-01-28 18:30:53 +00:00
Asim
1cc621e2d6 FromContext/NewContext methods 2016-01-28 18:23:24 +00:00
Asim
d306559d8f Nitpick Headers to Header 2016-01-28 18:11:13 +00:00
Asim
9ae0956cea Move context to metadata 2016-01-28 17:55:28 +00:00
Asim
013d1de2c4 Prefer RegisterTTL set through Init 2016-01-27 12:23:18 +00:00
Asim
5ec9d561a6 meh 2016-01-26 23:32:27 +00:00
Asim
51d2ce2b4f Support setting subscriber queue name 2016-01-22 21:48:43 +00:00
Asim
93ea171b31 We need the right sequence number for the stream 2016-01-21 01:03:27 +00:00
Asim
fb25558142 Merge pull request #42 from micro/internal_handler
Add implementation for internal handlers and subscribers.
2016-01-08 15:00:53 +00:00
Asim
f812613973 Add implementation for internal handlers and subscribers. They are not advertised to discovery 2016-01-08 14:02:32 +00:00
Jelmer Snoeck
3cefc39aff Debug: use the DebugHandler interface.
Without specifying the interface, DefaultDebugHandler has to be of type
*"github.com/micro/go-micro/server/debug".debug.
2016-01-07 10:15:30 +00:00
Asim
76918fc703 Make the debug handler an actual thing that can be set by users 2016-01-06 19:24:54 +00:00
Asim
66107fd304 Merge pull request #36 from jelmersnoeck/extendable-health-checker
DebugHandler: add default health checker.
2016-01-06 17:14:59 +00:00
Jelmer Snoeck
0d749eb732 DebugHandler: add default health checker.
By using a DefaultHealthChecker - as with a DefaultName, DefaultServer,
... - it is possible to overwrite the default implementation. This means
we can now do extra actions in our health check that is necessary for
the applications specific needs.
2016-01-06 17:05:22 +00:00
Asim
8bf72a3325 Replace map[string]string with Context for extra options. map[string]string is essentially useless. Context can store anything 2016-01-06 16:25:12 +00:00
Asim
f467902304 update the example to message the naming of code generated protos 2016-01-06 12:37:35 +00:00
Asim
3e84c23591 Tell me what the registry is too 2016-01-04 23:27:44 +00:00
Asim
227adc490c Add broker and server to metadata 2016-01-04 01:27:05 +00:00
Asim
3b56a62589 Update the way flags are used 2016-01-02 19:12:17 +00:00
Asim
1f1bc27421 Make command internal 2016-01-02 00:38:57 +00:00
Asim
64b45f7846 Update options to be public. This means people can implement the interfaces and actually use the options 2015-12-31 18:11:46 +00:00
Asim
3dd911fb33 Stop recursive loop where its a recursive type 2015-12-25 01:06:51 +00:00
Asim
34947f1be7 Merge pull request #32 from micro/broker
Update the broker interface to support acking and queue distribution
2015-12-24 20:03:24 +00:00
Asim
1da6de05ee Fix server panic 2015-12-23 22:45:32 +00:00
Asim
536216fd01 Fix the rest of the code 2015-12-23 19:16:55 +00:00
Asim
6226a80e78 Print stack when panic 2015-12-21 17:18:04 +00:00
Asim
be43d827c7 Add String method to all interfaces 2015-12-19 21:56:14 +00:00
Asim
3b295b16e7 Working bidirectional streaming example 2015-12-18 20:28:50 +00:00
Asim
4cba0c57ab Checkpoint the world 2015-12-18 01:01:59 +00:00
Asim
6ae48c9f29 checkpoint 2015-12-17 20:37:35 +00:00
Asim
ba3b056e76 add headers 2015-12-16 02:15:09 +00:00
Asim
dd73c1f0ac support slices in extractor, longer term need to look at all types 2015-12-07 16:12:46 +00:00
Asim
919bfed0c1 add comments 2015-12-03 01:05:16 +00:00
Asim
20114ccd87 move the comment 2015-12-03 00:59:32 +00:00
Asim
a69811fc72 Fix the sub extractor 2015-12-03 00:49:58 +00:00
Asim
9c17e64ef1 add comments for wrappers 2015-12-02 21:16:44 +00:00
Asim
5e364693ee Rename to hdlrWrappers for symmetry sake 2015-12-02 21:12:09 +00:00
Asim
96d7975052 make it clear that it flags streaming response 2015-12-02 21:02:46 +00:00
Asim
a695e10d21 Send Request and Publication types 2015-12-02 20:56:50 +00:00
Asim
4b18b779aa Update to use actual values passed through the chain 2015-12-02 20:11:00 +00:00
Asim
eef155490e Setup subscription wrappers 2015-12-02 19:56:57 +00:00
Asim
cfa676af19 Only support single signature for subscriber and validate 2015-12-02 17:42:14 +00:00
Asim
b1511ed813 Update wrapper and examples 2015-12-02 11:54:36 +00:00
Asim
c5a08d3159 Some nitpicking 2015-12-02 01:38:56 +00:00
Asim
7a870dfbb1 Strip named registration 2015-12-02 01:18:32 +00:00
Asim
dae745f30f Experimental server side wrappers for handlers 2015-12-02 00:47:52 +00:00
Asim
0c9f8411bb Pull rpcplus in local for the time being. We need to modify it for server side middleware 2015-12-01 23:32:23 +00:00
Asim
8825b5c0a8 rename debug handler 2015-12-01 19:13:48 +00:00
Asim
bf01feb2e3 Fix comment for godoc 2015-12-01 18:45:52 +00:00
Asim
d02986d1bd Add some comments 2015-12-01 18:41:43 +00:00
Asim
dddcdc34ed rename to protorpc and jsonrpc 2015-11-28 18:54:38 +00:00
Asim
80f53ab176 Add json codec 2015-11-28 18:40:32 +00:00
Asim
654728027b Updated codec interface and code. Painful stuff 2015-11-28 11:22:29 +00:00
Asim
f49922f6b3 experimental codec branch 2015-11-27 00:17:36 +00:00
Asim
ad6e8194ed Add client comments 2015-11-26 12:21:00 +00:00
Asim
24b8cd3d97 more comments 2015-11-26 00:23:36 +00:00
Asim
bb360d5f2c add comment 2015-11-26 00:18:39 +00:00
Asim
c4d8701d68 add comment 2015-11-26 00:17:05 +00:00
Asim
96955dbd53 add comments 2015-11-26 00:13:17 +00:00
Asim
40fea1ac24 nitpick ordering 2015-11-25 20:22:49 +00:00
Asim
12a1e1eeda Add pluggable codec support 2015-11-25 19:50:05 +00:00
Asim
469b12ecea Temporary stop gap for panicking server handlers 2015-11-24 00:52:59 +00:00
Asim
5d88115f2a update links from myodc to micro 2015-11-20 16:17:33 +00:00
Asim
2041591033 add advertising option 2015-11-11 18:22:04 +00:00
Asim
4e6d1df9ea Add extractor test 2015-11-05 12:39:08 +00:00
Asim
0dbe14ad22 Extract private ip for registration when 0.0.0.0 is specified as bind address 2015-11-04 21:53:39 +00:00
Asim
6b8855a337 Fix client rpc codec 2015-10-16 11:15:17 +01:00
Asim
0adc0e3c00 Fix rpc codec issue stopping json requests from working 2015-10-15 22:06:43 +01:00
Asim
763608854b Update subscriber name 2015-10-11 12:12:41 +01:00
Asim
fcbd2acdde add endpoint data for consul registry 2015-10-11 12:05:20 +01:00
Asim
558b060130 Change uuid library 2015-08-26 12:15:37 +01:00
Asim
b91af916f9 Add pub/sub to client/server and make broker more low level 2015-06-12 19:52:27 +01:00
Asim
cdf2f2cbcd Change receiver to handler, breaking change, grrr 2015-06-03 01:25:37 +01:00
Asim
09c784d294 add support for streaming requests. cleanup watcher initilisation 2015-06-01 18:55:27 +01:00
Asim
36b5ca46fe Change initialisation and add metadata 2015-05-26 22:39:48 +01:00
Asim
7aa2c82ced Service and node should be structs rather than interface 2015-05-25 22:14:28 +01:00
Asim
d4a7deb594 move proto/health to server since its only relevant to that 2015-05-25 18:57:05 +01:00
Asim
74fd1fc989 Restructure go-micro layout and plugins 2015-05-23 20:04:16 +01:00
Asim
e192f335da Dont expose rpc client/server 2015-05-23 17:40:53 +01:00
Asim
3db51216b2 Rework use of context 2015-05-23 11:53:40 +01:00
Asim
d67c1ba111 Fix health checker 2015-05-21 23:06:01 +01:00
Asim
c9df1cf7d2 use send/recv semantics 2015-05-21 21:08:19 +01:00
Asim
4f909d0be4 Declare option not options 2015-05-21 19:28:57 +01:00
Asim
9d514f0e60 further transport rework 2015-05-21 19:24:57 +01:00
Asim
50e44726f5 transport cruft 2015-05-20 22:57:19 +01:00
Asim
0e7bd77f4c Allow configurable addresses for everything 2015-05-16 00:34:02 +01:00
Asim
45a619c2c6 Fixup import paths 2015-05-05 19:05:06 +01:00
Asim
606255a7f3 Remove flags from server package. Create cmd package to parse flags and cli usage 2015-02-14 23:33:21 +00:00
Łukasz Kurowski
323dfbc818 Move from seelog to glog 2015-01-31 16:49:21 +01:00