Flash and Flex swc... and a little bit of Blazeds
mr_payne Nov 17, 2009 5:52 AMi have created a flex library project that connects to a BlazeDS endpoint for consumer/producer communication... i have used action script rather than configure the config.xml file on the server... heres a snip of the code...
channelSet = new ChannelSet();
var channel:AMFChannel = new AMFChannel("my-amf", "http://localhost:8400/test/messagebroker/amf");
channelSet.addChannel(channel);
consumer = new Consumer();
consumer.channelSet = channelSet;
consumer.destination = "myEndPoint";
consumer.subscribe();
consumer.addEventListener(MessageEvent.MESSAGE, test);
producer = new Producer();
producer.channelSet = channelSet;
producer.destination = "myEndPoint";
producer.addEventListener(MessageAckEvent.ACKNOWLEDGE, acknowledgeHandler);
producer.addEventListener(MessageFaultEvent.FAULT, faultHandler);
public function SendMessage(sendMe:String):void {
try{
trace("sending message" + sendMe);
var message:AsyncMessage = new AsyncMessage();
message.body = sendMe;
producer.send(message);
}
catch(error:Error){
trace(error.message);
}
}
private function faultHandler(event:MessageFaultEvent):void{
trace("not sent ---> " + event.message);
}
so i create my swc library... import it to a test flex app... and every thing works as it should.... which is great
when i import this swc to flash cs4 i get an interesting error... i get a MessageFaultEvent from the producer who cant seem to send a message to the endpoint....
(mx.messaging.messages::ErrorMessage)#0
body = (Object)#1
clientId = (null)
correlationId = "5F943F73-B844-333C-4765-F9A0A38B471B"
destination = ""
extendedData = (null)
faultCode = "Client.Error.MessageSend"
faultDetail = "Channel.Connect.Failed error null url: 'null'"
faultString = (null)
headers = (Object)#2
messageId = "B1821A77-2470-011A-1C73-F9A207DE3764"
rootCause = (mx.messaging.events::ChannelFaultEvent)#3
bubbles = false
cancelable = false
channel = (mx.messaging.channels::AMFChannel)#4
authenticated = false
channelSets = (Array)#5
connected = false
connectTimeout = -1
enableSmallMessages = true
endpoint = (null)
failoverURIs = (Array)#6
id = "my-amf"
mpiEnabled = false
netConnection = (flash.net::NetConnection)#7
client = (mx.messaging.channels::AMFChannel)#4
connected = true
connectedProxyType = "none"
farID = ""
farNonce = ""
maxPeerConnections = 8
nearID = "8d7005992325e80ac48f45e4dff2ce1d06751cfdd56a4e68bacec5796d8ef371"
nearNonce = ""
objectEncoding = 3
protocol = "rtmp"
proxyType = "none"
unconnectedPeerStreams = (Array)#8
uri = "null"
usingTLS = false
piggybackingEnabled = false
polling = false
pollingEnabled = true
pollingInterval = 3000
protocol = "http"
reconnecting = false
recordMessageSizes = false
recordMessageTimes = false
requestTimeout = -1
uri = "http://localhost:8400/test/messagebroker/amf"
url = "http://localhost:8400/test/messagebroker/amf"
useSmallMessages = false
channelId = "my-amf"
connected = false
currentTarget = (mx.messaging.channels::AMFChannel)#4
eventPhase = 2
faultCode = "Channel.Connect.Failed"
faultDetail = "null url: 'null'"
faultString = "error"
reconnecting = false
rejected = false
rootCause = (null)
target = (mx.messaging.channels::AMFChannel)#4
type = "channelFault"
timestamp = 0
timeToLive = 0
