Once you have successfully installed the AREX's Agent and configured it to use the Storage Service
, you can initiate a replay to verify the impact of new version deployments on your target host. This process helps in understanding whether the changes are as expected or not.
The replay process involves the following steps:
-
Retrieve Records: Load all records from the
Remote Storage Service
for each API operation, categorizing them by version. -
Prepare and Send Requests: Organize the request messages and dispatch them to the target host.
-
Collect Responses: Upon successful request transmission, gather all response results (including entry and dependent services) using
recordId
+replayId
. -
Result Comparison: Compare these results as per configurations, categorized by
MockCategoryType
(e.g., HTTP servlet, Redis, DB). -
Report Generation: Send the replay comparison results to the
API Service
for analysis and summary creation.
- Host Availability: Do not create a plan if the target host is unreachable.
- Error Handling: Interrupt the plan if more than 10% of request sending results in exceptions.
To set up the connection, modify the default localhost
values in resources/META-INF/application.properties
. Here's how you can configure for Redis
, MySQL
, and dependent web services
:
# Web API
arex.storage.service.api=http://10.3.2.42:8093/api/storage/replay/query
arex.api.service.api=http://10.3.2.42:8090/api/report
arex.config.service.api=http://10.3.2.42:8091/api/config
# MySQL
spring.datasource.url=jdbc:mysql://10.3.2.42:3306/arexdb?useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=arex_admin
spring.datasource.password=arex_admin_password
# Redis
arex.redis.uri=redis://10.3.2.42:6379/
The DefaultHttpReplaySender
handles HTTP requests (PUT, GET, POST, DELETE, etc.). To implement a custom sender, follow the ReplaySender
interface pattern:
public interface ReplaySender {
/**
* Indicate the instance should be working for the message content type,
* return true should be used,others skipped
*/
boolean isSupported(int contentType);
/**
* Try to send the replay case to remote target host
*/
boolean send(ReplayActionCaseItem caseItem);
/**
* Try to send the request message to remote target host
*/
ReplaySendResult send(SenderParameters senderParameters);
/**
* Try to prepare the replay case remote dependency such as resume config files
*/
boolean prepareRemoteDependency(ReplayActionCaseItem caseItem);
/**
* Try to warm up the remote target service before sending
*/
default boolean activeRemoteService(ReplayActionCaseItem caseItem) {
return true;
}
}
To generate comprehensive reports, additional information such as the target image version and source code author is required. Implement the DeploymentEnvironmentProvider
interface to provide this data:
public interface DeploymentEnvironmentProvider {
DeploymentVersion getVersion(String appId, String env);
List<ServiceInstance> getActiveInstanceList(AppServiceDescriptor serviceDescriptor, String env);
}
- Code: Apache-2.0