Act is a passive th2 component with parameterized functions which is implemented as part of the test logic. Script or other components can call these functions via gRPC. Act can interact with codec, hands, check1s, other acts to execute its tasks. Information about the progress of the task is published to the estore th2 component via MQ pin. This th2 component type allows frequently used script logic into it and then share it between all th2 components.
This project is implemented gRPC API described in the th2-grpc-act-template
Most of them consists of the next steps:
- Gets a gRPC request with parameters.
- If
check1Enabledoption is true, requests checkpoint from check1 via gRPC pin otherwise generates empty checkpoint - Sends the passed business message to Codec via mq pin
- Waits the specific business message from Codec during specified timeout
- Returns responded business message with checkpoint (checkpoint is empty when
check1Enabledoption is false)
It is also possible to send raw messages ( containing metadata and having payload in original format ) directly to conn components without waiting while message will be encoded by codec and then sent to conn component. For that you need to:
- Send rpc request using
SendRawMessageRequestandsendRawMessagerpc that is defined in th2-grpc-act-template - Transport group with
RawMessagewill be published to pins withsend_rawattribute.
It is also possible to place messages for th2-conn-http-client. This rpc call sends request with act event id and waits response with the same event id. After receiving response, act check statusCode field to calculate rpc response status.
For that you need to send rpc request using PlaceHttpRequest and placeHttpRequest rpc that is defined in th2-grpc-act-template
placeHttpRequest rpc supports the scenarios:
- place header only:
- requirements:
PlaceHttpRequest.httpHeader.messageTypemust haveRequestvalue. - schema: act =[parsed]=> conn-http
- pin attributes: [
transport-group,send_http]
- requirements:
- place parsed body only:
- schema: act =[parsed]=> codec-* =[raw]=> conn-http
- pin attributes: [
transport-group,send]
- place raw body only:
- schema: act =[raw]=> conn-http
- pin attributes: [
transport-group,send_http]
- place header and parsed body:
- requirements:
PlaceHttpRequest.httpHeader.messageTypemust haveRequestvalue.PlaceHttpRequest.httpHeader.metadata.protocolmust not be blank to avoidcodec-*encoding).
- schema: act =[parsed,parsed]=> codec-* =[parsed,raw]=> conn-http
- pin attributes: [
transport-group,send]
- requirements:
- place header and raw body:
- requirements:
PlaceHttpRequest.httpHeader.messageTypemust haveRequestvalue. - schema: act =[parsed,raw]=> conn-http
- pin attributes: [
transport-group,send_http]
- requirements:
apiVersion: th2.exactpro.com/v2
kind: Th2Box
metadata:
name: act
spec:
type: th2-act
customConfig:
response-timeout: 10000
check1-enabled: true
pins:
mq:
publishers:
- name: to_codec_fix
attributes: [publish, transport-group, send]
filters:
- metadata:
- fieldName: "session_alias"
expectedValue: "*-fix-*"
operation: WILDCARD
- name: to_codec_json
attributes: [publish, transport-group, send]
filters:
- metadata:
- fieldName: "session_alias"
expectedValue: "*-http-*"
operation: WILDCARD
- name: to_conn_client_fix
attributes: [publish, transport-group, send_raw]
filters:
- metadata:
- fieldName: "session_alias"
expectedValue: "client-fix-*"
operation: WILDCARD
- name: to_conn_client_http
attributes: [publish, transport-group, send_http]
filters:
- metadata:
- fieldName: "session_alias"
expectedValue: "client-http-*"
operation: WILDCARD
subscribers:
- name: from_codec
attributes: [subscribe, transport-group, oe]
linkTo:
- box: codec-fix
pin: out_realtime_decode
grpc:
client:
- name: to_check1 # this pin optional when spec.customConfig.check1Enabled: false
serviceClass: com.exactpro.th2.check1.grpc.Check1Service
linkTo:
- box: check1
pin: server
server:
- name: server
serviceClasses:
- com.exactpro.th2.act.grpc.ActServiceAlso we recommend to
apply th2-box-descriptor-generator plugin. It allows
generating a th2 descriptor. CI should publish the project's docker image with the descriptor content as the value of
the protobuf-description-base64 label. Such descriptors can be used to interact with a box-raised gRPC server.
- Produce multi-platform docker image
- migrated to amazoncorretto:11-alpine-jdk docker image as base
- Updated:
- th2 gradle plugin:
0.3.10(bom:4.14.2) - kotlin:
2.2.21
- th2 gradle plugin:
- [GH-130]
placeHttpRequestmethod implemented - Provided
response-timeoutoption
- Provided
check1-enabledoption - Migrate to th2 gradle plugin
0.3.9(th2-bom:4.14.1) - Updated:
- kotlin:
2.2.10 - common:
5.16.1-dev - common-utils:
2.4.0-dev - grpc-act-template:
4.3.1 - grpc-check1:
4.5.1
- kotlin:
multiSendMessagemethod implemented
- Use pins with
sendpin attribute for parsed messages sends.
- Added RPC to send raw messages.
- Updated grpc-act-template to
4.2.0
- Migrated to th2 transport protocol
- Updated bom to
4.5.0 - Updated kotlin to
1.8.22 - Updated common to
5.4.0 - Updated grpc-act-template to
4.1.0 - Updated grpc-check1 to
4.3.0 - Added common-utils
2.2.0
- 3.9.0 merged
- Update
kotlin.jvmversion from1.3.72to1.5.30 - Migration to books/pages cradle 4.0.0
- Update
th2-commonversion from3.26.4to4.0.0 - Update
th2-grpc-act-templateversion from3.4.0to4.0.0 - Update
th2-grpc-check1version from3.4.2to4.0.0
- Update
- th2-common to
3.44.1 - th2-bom to
4.2.0 - th2-grpc-check to
3.8.0 - grpc-check1 updated to
3.8.0 - updated gradle to 7.6
- Update
th2-grpc-act-templateversion from3.9.0to3.10.0 - Implement
placeOrderCancelRequestandplaceOrderCancelReplaceRequestmethods
- Update
th2-commonversion from3.26.4to3.44.0 - Update
th2-grpc-act-templateversion from3.4.0to3.9.0 - Update
th2-grpc-check1version from3.4.2to3.6.0 - Update
kotlinversion from1.3.72to1.6.21
- Update
th2-commonversion from3.16.5to3.26.4 - Update
th2-grpc-act-templateversion from3.2.0to3.4.0 - Update
th2-grpc-check1version from3.2.0to3.4.2
- Make gRPC response objects containing logs about the errors that happened in gRPC methods
- Fixed configuration for gRPC server.
- Added the property workers, which changes the count of gRPC server's threads
- add creation of error event in case the
sendMessagecall did not success
- migration to Sonatype
- removed gRPC event loop handling
- fixed dictionary reading
- reads dictionaries from the /var/th2/config/dictionary folder.
- uses mq_router, grpc_router, cradle_manager optional JSON configs from the /var/th2/config folder
- tries to load log4j.properties files from sources in order: '/var/th2/config', '/home/etc', configured path via cmd, default configuration
- update Cradle version. Introduce async API for storing events