Java Code Examples for org.apache.rocketmq.common.UtilAll#bytes2string()

The following examples show how to use org.apache.rocketmq.common.UtilAll#bytes2string() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageDecoder.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
    input.flip();
    input.limit(MessageDecoder.MSG_ID_LENGTH);

    input.put(addr);
    input.putLong(offset);

    return UtilAll.bytes2string(input.array());
}
 
Example 2
Source File: MessageDecoder.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
    ByteBuffer byteBuffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
    InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
    byteBuffer.put(inetSocketAddress.getAddress().getAddress());
    byteBuffer.putInt(inetSocketAddress.getPort());
    byteBuffer.putLong(transactionIdhashCode);
    byteBuffer.flip();
    return UtilAll.bytes2string(byteBuffer.array());
}
 
Example 3
Source File: MessageDecoder.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
    input.flip();
    input.limit(MessageDecoder.MSG_ID_LENGTH);

    input.put(addr);
    input.putLong(offset);

    return UtilAll.bytes2string(input.array());
}
 
Example 4
Source File: MessageDecoder.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
    ByteBuffer byteBuffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
    InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
    byteBuffer.put(inetSocketAddress.getAddress().getAddress());
    byteBuffer.putInt(inetSocketAddress.getPort());
    byteBuffer.putLong(transactionIdhashCode);
    byteBuffer.flip();
    return UtilAll.bytes2string(byteBuffer.array());
}
 
Example 5
Source File: MessageDecoder.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
    input.flip();
    input.limit(MessageDecoder.MSG_ID_LENGTH);

    input.put(addr);
    input.putLong(offset);

    return UtilAll.bytes2string(input.array());
}
 
Example 6
Source File: MessageDecoder.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
    ByteBuffer byteBuffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
    InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
    byteBuffer.put(inetSocketAddress.getAddress().getAddress());
    byteBuffer.putInt(inetSocketAddress.getPort());
    byteBuffer.putLong(transactionIdhashCode);
    byteBuffer.flip();
    return UtilAll.bytes2string(byteBuffer.array());
}
 
Example 7
Source File: MessageDecoder.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
/**
 * 创建Message编号
 *
 * @param input  input字节缓冲流
 * @param addr   socket地址字节缓冲流
 * @param offset 地址
 * @return Message编号
 */
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
    input.flip();
    input.limit(MessageDecoder.MSG_ID_LENGTH);

    input.put(addr);
    input.putLong(offset);

    return UtilAll.bytes2string(input.array());
}
 
Example 8
Source File: MessageDecoder.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
    ByteBuffer byteBuffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
    InetSocketAddress inetSocketAddress = (InetSocketAddress)socketAddress;
    byteBuffer.put(inetSocketAddress.getAddress().getAddress());
    byteBuffer.putInt(inetSocketAddress.getPort());
    byteBuffer.putLong(transactionIdhashCode);
    byteBuffer.flip();
    return UtilAll.bytes2string(byteBuffer.array());
}
 
Example 9
Source File: MessageDecoder.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
    input.flip();
    input.limit(MessageDecoder.MSG_ID_LENGTH);

    input.put(addr);
    input.putLong(offset);

    return UtilAll.bytes2string(input.array());
}
 
Example 10
Source File: MessageDecoder.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
    ByteBuffer byteBuffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
    InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
    byteBuffer.put(inetSocketAddress.getAddress().getAddress());
    byteBuffer.putInt(inetSocketAddress.getPort());
    byteBuffer.putLong(transactionIdhashCode);
    byteBuffer.flip();
    return UtilAll.bytes2string(byteBuffer.array());
}
 
Example 11
Source File: MessageDecoder.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
    input.flip();
    input.limit(MessageDecoder.MSG_ID_LENGTH);
    // 消息存储主机地址 IP PORT 8
    input.put(addr);
    // 消息对应的物理分区 OFFSET 8
    input.putLong(offset);

    return UtilAll.bytes2string(input.array());
}
 
Example 12
Source File: MessageDecoder.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
    ByteBuffer byteBuffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
    InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
    byteBuffer.put(inetSocketAddress.getAddress().getAddress());
    byteBuffer.putInt(inetSocketAddress.getPort());
    byteBuffer.putLong(transactionIdhashCode);
    byteBuffer.flip();
    return UtilAll.bytes2string(byteBuffer.array());
}
 
Example 13
Source File: MessageDecoder.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
    input.flip();
    input.limit(MessageDecoder.MSG_ID_LENGTH);

    input.put(addr);
    input.putLong(offset);

    return UtilAll.bytes2string(input.array());
}
 
Example 14
Source File: MessageDecoder.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
    ByteBuffer byteBuffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
    InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
    byteBuffer.put(inetSocketAddress.getAddress().getAddress());
    byteBuffer.putInt(inetSocketAddress.getPort());
    byteBuffer.putLong(transactionIdhashCode);
    byteBuffer.flip();
    return UtilAll.bytes2string(byteBuffer.array());
}
 
Example 15
Source File: MessageDecoder.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
    input.flip();
    int msgIDLength = addr.limit() == 8 ? 16 : 28;
    input.limit(msgIDLength);

    input.put(addr);
    input.putLong(offset);

    return UtilAll.bytes2string(input.array());
}
 
Example 16
Source File: MessageDecoder.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
    InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
    int msgIDLength = inetSocketAddress.getAddress() instanceof Inet4Address ? 16 : 28;
    ByteBuffer byteBuffer = ByteBuffer.allocate(msgIDLength);
    byteBuffer.put(inetSocketAddress.getAddress().getAddress());
    byteBuffer.putInt(inetSocketAddress.getPort());
    byteBuffer.putLong(transactionIdhashCode);
    byteBuffer.flip();
    return UtilAll.bytes2string(byteBuffer.array());
}