go.uber.org/yarpc@v1.72.1/transport/tchannel/doc.go (about) 1 // Copyright (c) 2022 Uber Technologies, Inc. 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 // 10 // The above copyright notice and this permission notice shall be included in 11 // all copies or substantial portions of the Software. 12 // 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 // THE SOFTWARE. 20 21 // Package tchannel implements a YARPC transport based on the TChannel 22 // protocol. The TChannel transport provides support for Unary RPCs only. 23 // 24 // Usage 25 // 26 // To use TChannel with YARPC load balancers, use the NewTransport constructor. 27 // To use TChannel with a channel shared with other systems like Ringpop, use 28 // NewChannelTransport. 29 // 30 // You can let YARPC own and manage the TChannel Channel for you by providing 31 // the service name. Note that this is the name of the local service, not the 32 // name of the service you will be sending requests to. 33 // 34 // tchannelTransport, err := tchannel.NewTransport(tchannel.ServiceName("myservice")) 35 // 36 // Alternatively, and only when necessary to share an underlying channel, 37 // ChannelTransport must be constructed to use this transport. You can provide 38 // an existing TChannel Channel to construct the ChannelTransport. 39 // In this configuration, the transport cannot use YARPC load balancers. 40 // 41 // ch := getTChannelChannel() 42 // tchannelTransport, err := tchannel.NewChannelTransport(tchannel.WithChannel(ch)) 43 // 44 // To serve a YARPC application over TChannel, pass a TChannel inbound in your 45 // yarpc.Config. 46 // 47 // myInbound := tchannelTransport.NewInbound() 48 // dispatcher := yarpc.NewDispatcher(yarpc.Config{ 49 // Name: "myservice", 50 // Inbounds: yarpc.Inbounds{myInbound}, 51 // }) 52 // 53 // To make requests to a YARPC application that supports TChannel, pass a 54 // TChannel outbound in your yarpc.Config. 55 // 56 // myserviceOutbound := tchannelTransport.NewOutbound() 57 // dispatcher := yarpc.NewDispatcher(yarpc.Config{ 58 // Name: "myservice", 59 // Outbounds: yarpc.Outbounds{ 60 // "outboundservice": {Unary: myserviceOutbound}, 61 // }, 62 // }) 63 // 64 // Configuration 65 // 66 // A TChannel transport may be configured using YARPC's configuration system. 67 // See TransportConfig, InboundConfig, and OutboundConfig for details on the 68 // different configuration parameters supported by this transport. 69 package tchannel