public InLongHttpMsgSender genHttpSenderByGroupId(
            HttpMsgSenderConfig configure) throws ProxySdkException {
        validProxyConfigNotNull(configure);
        // query cached sender
        String metaConfigKey = configure.getGroupMetaConfigKey();
        InLongHttpMsgSender messageSender =
                (InLongHttpMsgSender) groupIdSenderMap.get(metaConfigKey);
        if (messageSender != null) {
            return messageSender;
        }
        // valid configure info
        ProcessResult procResult = new ProcessResult();
        qryProxyMetaConfigure(configure, procResult);
        // generate sender
        senderCacheLock.writeLock().lock();
        try {
            // re-get the created sender based on the groupId key after locked
            messageSender = (InLongHttpMsgSender) groupIdSenderMap.get(metaConfigKey);
            if (messageSender != null) {
                return messageSender;
            }
            // build a new sender based on groupId
            messageSender = new InLongHttpMsgSender(configure, msgSenderFactory, null);
            if (!messageSender.start(procResult)) {
                messageSender.close();
                throw new ProxySdkException("Failed to start groupId sender: " + procResult);
            }
            groupIdSenderMap.put(metaConfigKey, messageSender);
            logger.info("MsgSenderFactory({}) generated a new groupId({}) sender({})",
                    this.factoryNo, metaConfigKey, messageSender.getSenderId());
            return messageSender;
        } catch (Throwable ex) {
            if (exptCounter.shouldPrint()) {
                logger.warn("MsgSenderFactory({}) build groupId sender({}) exception",
                        this.factoryNo, metaConfigKey, ex);
            }
            throw new ProxySdkException("Failed to build groupId sender: " + ex.getMessage());
        } finally {
            senderCacheLock.writeLock().unlock();
        }
    }
Base Message Sender Factory

Used to manage the instance relationship of the sender factory.
Since both singleton and multiple instances involve the same relationship,
they are abstracted and maintained separately here.
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/BaseMsgSenderFactory.java