Mayday171
Jun 4th, 2009, 07:43 AM
Hey Guys,
There is a problem and I hope that you can help me :-).
I have coded an Adapter for flex messaging:
public class FlexDeviceDataListener extends ServiceAdapter implements DeviceDataListener {
private String data = "Test";
public void newDataReceived(String deviceId) {
/*MessageBroker msgBroker = MessageBroker.getMessageBroker(null);
String clientID = UUIDUtils.createUUID();
// creating a new async message.
AsyncMessage msg = new AsyncMessage();
// setting the destination for this message.
msg.setDestination("DataPush");
msg.setClientId(clientID);
msg.setMessageId(UUIDUtils.createUUID());
msg.setBody(deviceId);
msg.setHeader("topic", "flex.messaging.unknownData");
msgBroker.routeMessageToService(msg, null);*/
}
}
I have declared it in the spring config like this:
<bean id="dataPushAdapter" class="org.springframework.flex.core.ManageableComponentF actoryBean">
<constructor-arg value="rm.proemion.ui.flex.commons.FlexDeviceDataListener"/>
</bean>
And for the message-destination I hav added this:
<flex:message-destination id="dataPush" channels="my-streaming-amf,my-polling-amf"
service-adapter="dataPushAdapter"/>
Now the problem ;-):
If the server gets new data the newDataReceived method in the FlexDeviceDataListener class will trigger. This java method should route the message to the flex client which is subscribed. The problem is that the messageBroker that I want to get to route the message ist null. Its throws a NullPointerException everytime it try to get the messageBroker instance.
What goes wrong there??
Do I have to declare an extra MessageBroker in spring config ??
THX
There is a problem and I hope that you can help me :-).
I have coded an Adapter for flex messaging:
public class FlexDeviceDataListener extends ServiceAdapter implements DeviceDataListener {
private String data = "Test";
public void newDataReceived(String deviceId) {
/*MessageBroker msgBroker = MessageBroker.getMessageBroker(null);
String clientID = UUIDUtils.createUUID();
// creating a new async message.
AsyncMessage msg = new AsyncMessage();
// setting the destination for this message.
msg.setDestination("DataPush");
msg.setClientId(clientID);
msg.setMessageId(UUIDUtils.createUUID());
msg.setBody(deviceId);
msg.setHeader("topic", "flex.messaging.unknownData");
msgBroker.routeMessageToService(msg, null);*/
}
}
I have declared it in the spring config like this:
<bean id="dataPushAdapter" class="org.springframework.flex.core.ManageableComponentF actoryBean">
<constructor-arg value="rm.proemion.ui.flex.commons.FlexDeviceDataListener"/>
</bean>
And for the message-destination I hav added this:
<flex:message-destination id="dataPush" channels="my-streaming-amf,my-polling-amf"
service-adapter="dataPushAdapter"/>
Now the problem ;-):
If the server gets new data the newDataReceived method in the FlexDeviceDataListener class will trigger. This java method should route the message to the flex client which is subscribed. The problem is that the messageBroker that I want to get to route the message ist null. Its throws a NullPointerException everytime it try to get the messageBroker instance.
What goes wrong there??
Do I have to declare an extra MessageBroker in spring config ??
THX