Здравствуйте , пытаюсь разобраться с брокером сообщения использую spring .
В консоль сообщения приходят
В web-блок е
@Configuration
class TmyClass{
@Bean
public SimpleMessageListenerContainer messageListenerContainer1() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setQueueNames("queue2");
container.setMessageListener(new MessageListener() {
public void onMessage(Message message) {
System.out.println("c received from queue2 : " + new String(message.getBody()));
//events.publish(new myEvents(new String(message.getBody())));
}
});
return container;
}
а если попытаться на форму их вывести (через событие ) то выдается исключение
Caused by: java.lang.SecurityException: No security context bound to the current thread .
Если из потока посылать тоже исключение генерируется
public void ff0() {
Thread r=new Thread() {
@Override
public void run() {
while(true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("11111");
events.publish(new myEvents(new String("77-88")));
}
}
};
r.start();}
Screen.java
@Inject
Label label;
HH hh;
public void onButton_1Click() {
hh=(HH) AppContext.getApplicationContext().getBean("hh");
System.out.println("HH=="+hh);
hh.ff0();}
EventListener
protected void onUserRemove(myEvents event) {
System.out.println("User is removed " + event.getSource());
label.setValue(event.getSource());
}
Подскажите , можно ли получать сообщения от брокера сообщения и выводить их на форму?
что можно сделать ,
как выводить на форму то что получают spring бины прописанные в web модуле
configure(webModule) {
configurations {
webcontent
}
dependencies {
provided(servletApi)
compile(globalModule)
compile group: 'org.springframework.amqp', name: 'spring-amqp', version: '2.1.0.RELEASE'
compile group: 'org.springframework.amqp', name: 'spring-rabbit', version: '2.1.0.RELEASE'
}
)?
похоже придется зачитывать сообщения из брокера на сервере и писать в бд, а пользователь по таймеру будет зачитывать свои сообщения 

