1、数据库PG切换为达梦的修改版本。
This commit is contained in:
+7
-4
@@ -1,23 +1,26 @@
|
||||
package com.netty;
|
||||
|
||||
import com.haobang.config.AppConfig;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.socket.DatagramChannel;
|
||||
import io.netty.handler.codec.string.StringDecoder;
|
||||
import io.netty.handler.codec.string.StringEncoder;
|
||||
import io.netty.util.CharsetUtil;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* UDP 通道初始化器
|
||||
*/
|
||||
public class SyslogUdpChannelInitializer extends ChannelInitializer<DatagramChannel> {
|
||||
private static final Charset SYSLOG_CHARSET = AppConfig.getSyslogCharset();
|
||||
|
||||
@Override
|
||||
protected void initChannel(DatagramChannel ch) throws Exception {
|
||||
ChannelPipeline pipeline = ch.pipeline();
|
||||
|
||||
// 添加字符串解码器和编码器
|
||||
pipeline.addLast("decoder", new StringDecoder(CharsetUtil.UTF_8));
|
||||
pipeline.addLast("encoder", new StringEncoder(CharsetUtil.UTF_8));
|
||||
// 添加字符串解码器和编码器(使用可配置的字符集)
|
||||
pipeline.addLast("decoder", new StringDecoder(SYSLOG_CHARSET));
|
||||
pipeline.addLast("encoder", new StringEncoder(SYSLOG_CHARSET));
|
||||
|
||||
// 添加业务处理器
|
||||
pipeline.addLast("handler", new SyslogMessageHandler());
|
||||
|
||||
Reference in New Issue
Block a user