class FiscoBcosBroker4Producer extends FiscoBcosTopicAdmin implements IProducer {

    @Override
    public CompletableFuture<SendResult> publish(WeEvent event, String groupIdStr) throws BrokerException {
        log.debug("publish {} groupId: {}", event, groupIdStr);

        String groupId = selectGroupId(groupIdStr);
        this.validateGroupId(groupId);
        ParamCheckUtils.validateEvent(event);

        // publishEvent support async operator in callback
        if (event.getExtensions().containsKey(WeEvent.WeEvent_SIGN)) {
            return fiscoBcosDelegate.sendRawTransaction(event.getTopic(),
                    Long.parseLong(groupId),
                    new String(event.getContent(), StandardCharsets.UTF_8));
        } else {
            if (event.getExtensions().containsKey(WeEvent.WeEvent_EPHEMERAL)) {
                log.info("ephemeral event");
                return fiscoBcosDelegate.sendAMOP(event.getTopic(), Long.parseLong(groupId), JsonHelper.object2Json(event));
            } else {
                return fiscoBcosDelegate.publishEvent(event.getTopic(),
                        Long.parseLong(groupId),
                        new String(event.getContent(), StandardCharsets.UTF_8),
                        JsonHelper.object2Json(event.getExtensions()));
            }
        }
    }

    public  FiscoBcosBroker4Producer(FiscoBcosDelegate fiscoBcosDelegate);

}