Search in sources :

Example 16 with EndpointEntity

use of com.zx.sms.connect.manager.EndpointEntity in project SMSGate by Lihuanghe.

the class ChannelUtil method asyncWriteToEntity.

public static ChannelFuture asyncWriteToEntity(final String entity, final Object msg, GenericFutureListener listner) {
    EndpointEntity e = EndpointManager.INS.getEndpointEntity(entity);
    EndpointConnector connector = e.getSingletonConnector();
    return asyncWriteToEntity(connector, msg, listner);
}
Also used : EndpointConnector(com.zx.sms.connect.manager.EndpointConnector) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Example 17 with EndpointEntity

use of com.zx.sms.connect.manager.EndpointEntity in project SMSGate by Lihuanghe.

the class ChannelUtil method syncWriteBinaryMsgToEntity.

/**
 * 同步发送消息类型 <br/>
 * 注意:该方法将直接发送至编码器,不会再调用BusinessHandler里的write方法了。
 * 因此对于Deliver和Submit消息必须自己进行长短信拆分,设置PDU等相关字段
 *一般此方法用来发送二进制短信等特殊短信,需要自己生成短信的二进制内容。
 *正常短信下发要使用 syncWriteLongMsgToEntity 方法
 */
public static <T extends BaseMessage> Promise<T> syncWriteBinaryMsgToEntity(String entity, BaseMessage msg) throws Exception {
    EndpointEntity e = EndpointManager.INS.getEndpointEntity(entity);
    EndpointConnector connector = e.getSingletonConnector();
    Promise<T> promise = connector.synwrite(msg);
    if (promise == null) {
        // 为空,可能是连接断了,直接返回
        return null;
    }
    return promise;
}
Also used : EndpointConnector(com.zx.sms.connect.manager.EndpointConnector) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Example 18 with EndpointEntity

use of com.zx.sms.connect.manager.EndpointEntity in project SMSGate by Lihuanghe.

the class CMPPClientEndpointConnector method doinitPipeLine.

@Override
protected void doinitPipeLine(ChannelPipeline pipeline) {
    CMPPCodecChannelInitializer codec = null;
    EndpointEntity entity = getEndpointEntity();
    if (entity instanceof CMPPEndpointEntity) {
        pipeline.addLast(GlobalConstance.IdleCheckerHandlerName, new IdleStateHandler(0, 0, ((CMPPEndpointEntity) getEndpointEntity()).getIdleTimeSec(), TimeUnit.SECONDS));
        codec = new CMPPCodecChannelInitializer(((CMPPEndpointEntity) getEndpointEntity()).getVersion());
    } else {
        pipeline.addLast(GlobalConstance.IdleCheckerHandlerName, new IdleStateHandler(0, 0, 30, TimeUnit.SECONDS));
        codec = new CMPPCodecChannelInitializer();
    }
    pipeline.addLast("CmppServerIdleStateHandler", GlobalConstance.idleHandler);
    pipeline.addLast(codec.pipeName(), codec);
    pipeline.addLast("sessionLoginManager", new SessionLoginManager(getEndpointEntity()));
}
Also used : SessionLoginManager(com.zx.sms.session.cmpp.SessionLoginManager) IdleStateHandler(io.netty.handler.timeout.IdleStateHandler) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Aggregations

EndpointEntity (com.zx.sms.connect.manager.EndpointEntity)18 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)8 EndpointConnector (com.zx.sms.connect.manager.EndpointConnector)4 ServerEndpoint (com.zx.sms.connect.manager.ServerEndpoint)3 EndpointManager (com.zx.sms.connect.manager.EndpointManager)2 SgipSessionLoginManager (com.zx.sms.session.sgip.SgipSessionLoginManager)2 SMGPSessionLoginManager (com.zx.sms.session.smgp.SMGPSessionLoginManager)2 SMPPSessionLoginManager (com.zx.sms.session.smpp.SMPPSessionLoginManager)2 CmppDeliverRequestMessage (com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage)1 CmppSubmitRequestMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage)1 SMGPDeliverMessage (com.zx.sms.codec.smgp.msg.SMGPDeliverMessage)1 SMGPLoginMessage (com.zx.sms.codec.smgp.msg.SMGPLoginMessage)1 SMGPSubmitMessage (com.zx.sms.codec.smgp.msg.SMGPSubmitMessage)1 Address (com.zx.sms.codec.smpp.Address)1 BaseBind (com.zx.sms.codec.smpp.msg.BaseBind)1 BindReceiver (com.zx.sms.codec.smpp.msg.BindReceiver)1 BindTransceiver (com.zx.sms.codec.smpp.msg.BindTransceiver)1 BindTransmitter (com.zx.sms.codec.smpp.msg.BindTransmitter)1 DeliverSm (com.zx.sms.codec.smpp.msg.DeliverSm)1 SubmitSm (com.zx.sms.codec.smpp.msg.SubmitSm)1