In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how Swoft 2.0.6 implements Rpc service client and non-Swoft framework external invocation". In daily operations, I believe many people have doubts about how to implement Rpc service client and non-Swoft framework external invocation in Swoft 2.0.6. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful to answer the question of "how to implement Rpc service client and non-Swoft framework external invocation with Swoft 2.0.6"! Next, please follow the editor to study!
1. Start the http and rpc services first.
I use docker-compose directly to start the service here.
You can also enter the swoft container and use the command to open the service.
Http command: php bin/swoft http:start
Rpc command: php bin/swoft rpc:start
2.RPC Server configuration parameters
There are two ways to start RPC services: start separately and integrate other services (Http/Websocket). Either way, you have to configure RPC in bean.php first.
'rpcServer' = > [' class' = > ServiceServer::class, 'port' = > 18307,]
The RPC service is integrated in 3.Http server startup. Its listener listens to a single RPC service and can listen to multiple RPC services at the same time.
'httpServer' = > [' class' = > HttpServer::class, 'port' = > 18306,' listener' = > ['rpc' = > bean (' rpcServer')], 'process' = > [/ /' monitor' = > bean (MonitorProcess::class) / / 'crontab' = > bean (CrontabProcess::class)] 'on' = > [/ / SwooleEvent::TASK = > bean (SyncTaskListener::class), / / Enable sync task SwooleEvent::TASK = > bean (TaskListener::class), / / Enable task must task and finish event SwooleEvent::FINISH = > bean (FinishListener::class)] / * @ see HttpServer::$setting * / 'setting' = > [' task_worker_num' = > 12, 'task_enable_coroutine' = > true,' worker_num' = > 6]]
5. Define the interface and implement the interface to provide RPC services. Note the version number customized note @ Service ()
6. Define Interfac
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.