Search in sources :

Example 1 with TransportMessage

use of io.transport.sdk.protocol.message.internal.TransportMessage in project transporter by wang4ever.

the class TransportClient method groupcast.

/**
 * 组播发送消息(指定的点对多one-to-many)
 *
 * @param toGroupId
 * @param payload
 * @return 通道对象(可用于控制同步发送方案: groupcast(..).sync())
 * @throws TransportException
 */
public Future<Message> groupcast(String toGroupId, String payload) throws TransportException {
    if (ByteBufs.isEmpty(toGroupId) || ByteBufs.isEmpty(payload))
        throw new TransportException("'toGroupId/payload' is not allowed to be empty.");
    String fromDeviceId = this.config.getDeviceId();
    TransportMessage msg = new TransportMessage(MsgType.TRANSPORT_REQ, fromDeviceId, null, toGroupId, payload);
    return this.execute(msg, true);
}
Also used : TransportException(io.transport.sdk.exception.TransportException) TransportMessage(io.transport.sdk.protocol.message.internal.TransportMessage)

Example 2 with TransportMessage

use of io.transport.sdk.protocol.message.internal.TransportMessage in project transporter by wang4ever.

the class TransportClients method groupcast.

/**
 * 组播发送消息(指定的点对多one-to-many)
 *
 * @param toGroupId
 * @param payload
 * @return 通道对象(可用于控制同步发送方案: groupcast(..).sync())
 * @throws TransportException
 */
public Future<Message> groupcast(String toGroupId, String payload) throws TransportException {
    if (StringUtil.isNullOrEmpty(toGroupId) || StringUtil.isNullOrEmpty(payload))
        throw new TransportException("'toGroupId/payload' is not allowed to be empty.");
    String fromDeviceId = Constants.processSerial;
    TransportMessage msg = new TransportMessage(MsgType.TRANSPORT_REQ, fromDeviceId, null, toGroupId, payload);
    return this.execute(msg, true);
}
Also used : TransportException(io.transport.sdk.exception.TransportException) TransportMessage(io.transport.sdk.protocol.message.internal.TransportMessage)

Example 3 with TransportMessage

use of io.transport.sdk.protocol.message.internal.TransportMessage in project transporter by wang4ever.

the class TransportClients method unicast.

/**
 * 单播发送消息(指定的点对点one-to-one)
 *
 * @param toDeviceId
 * @param payload
 * @return 通道对象(可用于控制同步发送方案: unicast(..).sync())
 * @throws TransportException
 */
public Future<Message> unicast(String toDeviceId, String payload) throws TransportException {
    if (StringUtil.isNullOrEmpty(toDeviceId) || StringUtil.isNullOrEmpty(payload))
        throw new TransportException("'toDeviceId/payload' is not allowed to be empty.");
    String fromDeviceId = Constants.processSerial;
    TransportMessage msg = new TransportMessage(fromDeviceId, toDeviceId, payload);
    return this.execute(msg, true);
}
Also used : TransportException(io.transport.sdk.exception.TransportException) TransportMessage(io.transport.sdk.protocol.message.internal.TransportMessage)

Example 4 with TransportMessage

use of io.transport.sdk.protocol.message.internal.TransportMessage in project transporter by wang4ever.

the class TransportClient method unicast.

/**
 * 单播发送消息(指定的点对点one-to-one)
 *
 * @param toDeviceId
 * @param payload
 * @return 通道对象(可用于控制同步发送方案: unicast(..).sync())
 * @throws TransportException
 */
public Future<Message> unicast(String toDeviceId, String payload) throws TransportException {
    if (ByteBufs.isEmpty(toDeviceId) || ByteBufs.isEmpty(payload))
        throw new TransportException("'toDeviceId/payload' is not allowed to be empty.");
    String fromDeviceId = this.config.getDeviceId();
    TransportMessage msg = new TransportMessage(fromDeviceId, toDeviceId, payload);
    return this.execute(msg, true);
}
Also used : TransportException(io.transport.sdk.exception.TransportException) TransportMessage(io.transport.sdk.protocol.message.internal.TransportMessage)

Aggregations

TransportException (io.transport.sdk.exception.TransportException)4 TransportMessage (io.transport.sdk.protocol.message.internal.TransportMessage)4