subprocess

package module
v0.0.0-...-fc14c3d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2019 License: MIT Imports: 8 Imported by: 0

README

sub_process

利用子进程进行业务处理
使用场景:主要逻辑使用go编写,其中的数据处理部分(不同场景处理方式不需要不一样),则使用脚本语言来处理,如php。

example

请看 _examples目录里的ping_pong

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool worker pool

func NewPool

func NewPool(cmd string, workers int) (*Pool, error)

NewPool 创建一个新的worker pool

func (*Pool) Close

func (p *Pool) Close() error

Close 资源回收清理

func (*Pool) Talk

func (p *Pool) Talk(txt string) string

Talk 和子进程进行交互,若交互失败,会一直重试直到成功

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker 工作子进程

func NewWorker

func NewWorker(cmdStr string, id int) (*Worker, error)

NewWorker 创建一个新的子进程

func (*Worker) Close

func (worker *Worker) Close() (err error)

Close 资源回收,包括关闭子进程等逻辑

func (*Worker) Talk

func (worker *Worker) Talk(request string) (resp string, err error)

Talk 使用子进程对数据进行处理

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL