Stomp的MessageMap格式完全不能用了吗?
我将 Java 中的 MapMessages 发送到 ActiveMQ,并使用 PHP 中的 Stomp 检索它们。我的消息创建代码如下所示:
MapMessage message = session.createMapMessage();
message.setInt("id", 42);
message.setInt("status", 42);
message.setString("result", "aString");
当我在 PHP 中检索它们时,创建的数组如下所示:
Array (
[map] => Array (
[0] => Array (
[entry] => Array (
[0] => Array (
[string] => id
[int] => 42
)
[1] => Array (
[string] => status
[int] => 42
)
[2] => Array (
[string] => Array (
[0] => result
[1] => aString
)
)
)
)
)
)
我应该用它做什么?有没有办法说服 Stomp 以合理的方式反序列化它,或者是否有一些 PHP 咒语可以让访问这个数组不那么痛苦?特别是,我不能只迭代条目并构建关联数组,因为如果存在字符串 & ,则该数组看起来完全不同。 int 而不是两个字符串。
I'm sending MapMessages in Java to ActiveMQ and retrieving them using Stomp in PHP. My message creation code looks like this:
MapMessage message = session.createMapMessage();
message.setInt("id", 42);
message.setInt("status", 42);
message.setString("result", "aString");
When I retrieve them in PHP, the array that's created looks like this:
Array (
[map] => Array (
[0] => Array (
[entry] => Array (
[0] => Array (
[string] => id
[int] => 42
)
[1] => Array (
[string] => status
[int] => 42
)
[2] => Array (
[string] => Array (
[0] => result
[1] => aString
)
)
)
)
)
)
What am I supposed to do with that? Is there a way to convince Stomp to unserialize it in a reasonable manner or is there some PHP incantation make accessing this array less painful? In particular, I can't just iterate through the entries and build an associative array because the array looks completely different if there is a string & int as opposed to two strings.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我的想法。有谁知道更清洁的解决方案?
这给了我:
这几乎就是我正在寻找的东西,但是到达那里的代码似乎非常脆弱。
Here's what I've come up with. Does anyone know of a cleaner solution?
This gives me:
which is pretty much what I'm looking for, but the code to get there seems pretty fragile.