Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

批量操作执行前事件发送缺失 #201

Closed
hanahmily opened this issue Nov 30, 2016 · 0 comments
Closed

批量操作执行前事件发送缺失 #201

hanahmily opened this issue Nov 30, 2016 · 0 comments

Comments

@hanahmily
Copy link
Contributor

监听器执行前获得的消息数量比升级生成的事件少

问题复现步骤:

  1. 增加监听器
DMLExecutionEventBus.register(new DMLExecutionEventListener() {
            @Override
            public String getName() {
                return "test";
            }
            
            @Subscribe
            @AllowConcurrentEvents
            public void subscribe(final DMLExecutionEvent event) {
               ......
            }
        });
  1. 执行sql
String sql = "INSERT INTO `t_order`(`order_id`, `user_id`, `status`) VALUES (?,?,?)";
        try (
                Connection connection = shardingDataSource.getConnection();
                PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
            preparedStatement.setInt(1, 3101);
            preparedStatement.setInt(2, 11);
            preparedStatement.setString(3, "BATCH");
            preparedStatement.addBatch();
            preparedStatement.setInt(1, 3102);
            preparedStatement.setInt(2, 12);
            preparedStatement.setString(3, "BATCH");
            preparedStatement.addBatch();
            preparedStatement.setInt(1, 3111);
            preparedStatement.setInt(2, 21);
            preparedStatement.setString(3, "BATCH");
            preparedStatement.addBatch();
            preparedStatement.setInt(1, 3112);
            preparedStatement.setInt(2, 22);
            preparedStatement.setString(3, "BATCH");
            preparedStatement.addBatch();
            int[] result = preparedStatement.executeBatch();
        }

期望的表现:

subscribe收到的事件的数量应该为8,4条 BEFORE类型,4条SUCCESS类型

观察到的表现:

subscribe收到的事件的数量应该为8,2条 BEFORE类型,4条SUCCESS类型

Sharding-JDBC版本: [1.4.0]
操作系统及版本: [OSX]

xydonne pushed a commit to xydonne/sharding-jdbc that referenced this issue Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant