BlazeDS - Spring - 消息传递 - 如何将数据从服务推送到 Flex 客户端?
由于我的服务,我想推送数据(消息传递)。
@Service
@RemotingDestination
public class LoginService implements ILoginService
{
// ...
@Autowired
private MessageBroker msgBroker;
// ...
@Transactional
public final Boolean MyServiceFct(String data)
{
// ...
// ... compute some result informations (with database informations, with current user session informations, etc.);
// this result must be after send to all clients ...
// creating a new async message and setting the result informations as content.
String clientID = UUIDUtils.createUUID();
AsyncMessage msg =new AsyncMessage(); // setting the destination for this message.
msg.setDestination("MyAdapterPushData");
msg.setClientId(clientID);
msg.setMessageId(UUIDUtils.createUUID());
msg.setBody("coucou");
msgBroker.routeMessageToService(msg,null);
return true;
}
通过此实现,无需执行任何操作...客户端不会收到任何信息。
那么,我如何从这样的服务推送数据呢?是否可以 ?
非常感谢你的帮助,
安东尼
Since my service, I would like to push data (messaging).
@Service
@RemotingDestination
public class LoginService implements ILoginService
{
// ...
@Autowired
private MessageBroker msgBroker;
// ...
@Transactional
public final Boolean MyServiceFct(String data)
{
// ...
// ... compute some result informations (with database informations, with current user session informations, etc.);
// this result must be after send to all clients ...
// creating a new async message and setting the result informations as content.
String clientID = UUIDUtils.createUUID();
AsyncMessage msg =new AsyncMessage(); // setting the destination for this message.
msg.setDestination("MyAdapterPushData");
msg.setClientId(clientID);
msg.setMessageId(UUIDUtils.createUUID());
msg.setBody("coucou");
msgBroker.routeMessageToService(msg,null);
return true;
}
With this implementation, nothing to do ... clients receiveid nothing.
So, how I push data from a service like that ? Is it possible ?
Thank you very much for your help,
Anthony
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
James,
好吧,你的解决方案非常好:-)但是,我有一个小问题:
在我的 bean 文件配置中,我必须这样写才能有良好的行为:
但是,如果在我的 messages-config.xml 文件中添加以下内容:
并评论这一行:
我的弹性客户收到任何东西:-(
感谢您的帮助
安东尼
James,
Ok, your solution is very good :-) But, I have a little problem:
in my bean file configuration, I must write this to have a good behavior:
But, if in my messaging-config.xml file add this :
and comment this line :
my flex clients receive anything :-(
Thanks for your help
Anthony
这很容易。类似:
详细信息:
http://static.springsource.org/spring -flex/docs/1.0.x/reference/html/ch05s06.html
It's very easy. Something like:
Details here:
http://static.springsource.org/spring-flex/docs/1.0.x/reference/html/ch05s06.html