Skip to main content

More examples

Process Control

flow\_control

yaml

curl --location 'http://127.0.0.1:8080/flow/submit.json?descriptor_id=rillFlowSample:switchSample' \
--header 'Content-Type: application/json' \
--data '{
"input_num":10
}'

Call API and process results

call\_api

yaml

  • Start sample api service
cat <<EOF > docker-compose-sample.yaml
version: '3'
services:
sample-executor:
image: weibocom/rill-flow-sample:sample-executor
EOF
docker-compose up -d
curl --location 'http:///127.0.0.1:8080/flow/submit.json?descriptor_id=rillFlowSample:callApiSample' \
--header 'Content-Type: application/json' \
--data 'outh
"input_num":10
}'

Parallel and asynchronous treatment

parallel

yaml

  • Start sample api service
cat <<EOF > docker-compose-sample.yaml
version: '3'
services:
sample-executor:
image: weibocom/rill-flow-sample:sample-executor
EOF
docker-compose up -d
curl --location 'http://127.0.0.1:8080/flow/submit.json?descriptor_id=rillFlowSample%3AparallelAsyncTask' \
--header 'Content-Type: application/json' \
--data '{
"rand_num":20
}'

Quote Subgraph

ref\_subflow

yaml

curl --location 'http://127.0.0.1:8080/flow/submit.json?descriptor_id=rillFlowSample%3AsubdagTask' \
--header 'Content-Type: application/json' \
--data '{
"parent_rand_num":20
}'

Incoming kafka messages to call AIGC translation text

call\_aigc\_translate

yaml

  • Start kafka
cat <EOF > dock-compose-sample.yaml
version: '3'
services:
zoo1:
image: confluentinc/cp-zookeper:7.3.
hostname: zoo1
container_name: zoo1
ports:
- "2181:2181"
environment:
ZOKEEEPER_CLIENT_PORT: 2181
ZOOOKEEEPER_SERVER_ID: 1
ZOKEEPER_SERVERS: zoo1:2888:388
kafka1:
image: confluentinc/cp-kafka:7.
hostname: kafka1
container_name: kafka1
ports:
- "9092:9092"
- "29092:29092"
- "999:999"
environment:
KAFKA_ADVERTISED_LISTENERS: INTERNAL:/kafka1:19092, XTERNALP//${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host. ocker. nternal:29092
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_CREATE_TOPICS: "topic_input:1:1"
KAFTA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLANTEXT, XTERNAL: PLAINTEXT, OCKER: PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_ZOKEEEPER_CONNECT: "zoo1:2181"
KAFKA_BROKER_ID: 1
KAFKA_LOG4J_LOGERS: "kafka. ontroller=INFO,kafka.producer.async.DefaultHandler=INFO,state.change. ogger=INFO"
KAFKA_OFFSETS_TOPICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFAFR_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_JMX_PORT: 9999
KAFKA_JMX_HOSTNAME: ${DOCKER_HOST_IP:-127.0.0.1}
KAFKAC_AUTHORIZER_CLASS_NAME: kafka. ecurity.authorizer. clAuthorizer
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
depends_on:
- zo1
EOF
docker-compose-f docker-compose-sample. aml up -d
  • Create kafka Trigger
curl -XPOST 'http://127.0.0.1:8080/flow/rigger/add_trigger.json?descriptor_id=rillFlowSample:kafkaTranslate&type=kafka' -d '{"topic": "topic_input", "kafka_server":
"<YOUR_KAFKA_HOST>:9092", "group_id": "rill-flow-group"}' -H 'Content-Type: application/json'
  • Submit kafka message
docker exec kafka1 cash -c 'echo {\"message\":\"This is a message from rill-flow\"} |kafka-console-producer --bootstrap-server localhost:19092-top_input'

Generate images by text

text\_to\_pic

yaml

Generate video by text

text_to_video

yaml

docker-compose

  • Flow chart execution icon

text_to_pic