Send an object using RabbitMQ

不羁的心 提交于 2019-12-05 05:37:22

It looks like the byte array you receive is empty. This happens because of this:

    } catch(IOException e){
        bytes = new byte[] {};
    }

When an exception is produced, the code doesn't warn you that something is broken and just sends an empty array instead. You should at least log the error.

The exception is being produced probably because you are trying to serialize a class that is not serializable. To make a class serializable you have to add "implements Serializable" to its declaration:

public class Data implements Serializable {
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!