Skip to content

Commit

Permalink
[e2eTest] add e2eTest model
Browse files Browse the repository at this point in the history
  • Loading branch information
wangkai committed Nov 3, 2023
1 parent 8d8c78a commit bf9bab9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 30 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/maven-package.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Redis runner example
on: push
on:
pull_request:
types: [ opened, reopened, synchronize ]
release:
types: [ created ]

jobs:
# Label of the runner job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@

package org.apache.rocketmq.eventbridge.adapter.storage.rocketmq.impl;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.eventbridge.domain.model.data.PutEventCallback;
import org.apache.rocketmq.eventbridge.domain.model.data.PutEventsResponseEntry;
import org.apache.rocketmq.eventbridge.exception.code.DefaultErrorCode;

@Slf4j
public class DefaultSendCallback implements SendCallback {

PutEventCallback putEventCallback;
Expand All @@ -37,15 +35,13 @@ public DefaultSendCallback(PutEventCallback putEventCallback) {

@Override
public void onSuccess(SendResult sendResult) {
log.info("send msg to topic :{} success result.", sendResult);
entry.setEventId(sendResult.getMsgId());
entry.setErrorCode(DefaultErrorCode.Success.getCode());
putEventCallback.endProcess(entry);
}

@Override
public void onException(Throwable throwable) {
log.error("send msg to topic : fail result.", throwable);
entry.setErrorCode(DefaultErrorCode.InternalError.getCode());
entry.setErrorMessage(throwable.getMessage());
putEventCallback.endProcess(entry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,8 @@ public boolean putEvent(String accountId, String eventBusName, EventBridgeEvent
String topicName = this.getTopicName(accountId, eventBusName);
Message msg = eventDataOnRocketMQConnectAPI.converter(accountId, topicName, eventBridgeEvent);
try {
log.info("send msg to topic :{} before.", topicName);
producer.send(msg, new DefaultSendCallback(putEventCallback), 1000L);
log.info("send msg to topic :{} end.", topicName);
} catch (Throwable e) {
log.info("send msg to topic :{} failed. and exception is {}", topicName, e.toString());
throw new EventBridgeException(EventBridgeErrorCode.InternalError, e);
}
return true;
Expand Down
21 changes: 0 additions & 21 deletions azure-pipelines.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void intEventTarget() {
if (eventTargets == null || eventTargets.isEmpty()) {
List<EventTarget> eventTargetList = Lists.newArrayList();
Map<String, Object> config = Maps.newHashMap();
config.put("fileName", System.getProperty("user.home")+"/demo");
config.put("fileName", System.getProperty("user.home") + "/demo");
config.put("line", "{\"form\":\"JSONPATH\",\"value\":\"$.data\"}");
EventTarget eventTarget = EventTarget.builder().name(DEFAULT_EVENT_TARGET_NAME).className(DEFAULT_EVENT_TARGET_CLASS).config(config).build();
eventTargetList.add(eventTarget);
Expand Down

0 comments on commit bf9bab9

Please sign in to comment.