logging in or signing up EAS306 Eagle Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 426 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: November 21, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript EAS306 Building a Chat Server with EAServer and PowerBuilder: EAS306 Building a Chat Server with EAServer and PowerBuilder Dean Jones [TeamSybase] CEO of PowerObjects dean@powerobjects.com (612) 339-3355Who We Are…: Who We Are… PowerObjects Multi-Million dollar consulting company Sybase Consulting Partner Value Added reseller Premier consulting partner Custom Solution Provider Specialize in EAServer and Web Development Offer Web application hosting Certified Developers staff PowerBuilder, Java and Microsoft Certifies Member of Team SybaseOverview: Overview Building a Chat server using PowerBuilder and EAServer Using Java Message Service Publishing Messages Subscribing to Messages PowerBuilder Components Pushed messages onMessage Event Taking it one step furtherMessage Service: Message Service EAServer’s message service provides a powerful means by which to leverage multiple threads in your distributed applications Message Service: Message Service The message service provides queues for message consumers Allows message producers to send messages to specified queues (point-to-point messaging) Publish messages with specified topics that may be of interest to registered consumers (publish/subscribe messaging) There are two parts to the message service A Publisher A ConsumerMessage Service: Message ServicePublishing Messages: Publishing Messages To publish a message, there are three steps: Create a proxy for message service Populate the message PublishPowerBuilder Proxy: PowerBuilder Proxy Before you can send a message to the queue you must generate MessageService Proxy NOTE: The objects created will have an issue with wchar To fix you must edit the source and replace wchar data type with String data typePopulate the Message: Populate the Message A message is a structure of information to send to the serverPublish: Publish Publish a message with the specified message topic. A copy of this message will be sent to the queues for all consumers who have registered a message selector that returns TRUE when applied to this message void publish ( in string topic, in CtsComponents::Message msg, in long options );Chat Application: Chat Application You type a message into a single line edit and send when the user clicks Send.Chat Application: Chat ApplicationConsuming Messages: Consuming Messages To retrieve messages, there are two options: First is to pull messages from a given queue Second option is to let the message service push messages EAServer cannot push messages to a PowerBuilder client application, it can only push messages to PowerBuilder component EAServer can push messages to a Java client Consuming Messages: Consuming Messages Consumers of messages can either pull messages or have them pushed. There are three steps to pulling messages: Connect to the Message Service Specify a Queue and a Topic Receive messages To be a consumer of pushed messages, three steps must be taken: Implement Message Listener Code the onMessage event Register the receiving component using code or message service manager Connect to Message Service: Connect to Message Service ctsComponents_MessageService cms ctscomponents_messageseq cseq ctscomponents_messagequeue cmsg ctscomponents_message cm ctscomponents_messagekey after string sz_queue int i connection c c = CREATE connection c.application = "" c.location = "iiop://jones-dean:9000" c.userid = "jagadmin" c.password = "sarah" c.driver = "jaguar" c.ConnectToServer() c.CreateInstance(cms, "CtsComponents/MessageService") Receive Messages: Receive Messages sz_queue = cms.getUniqueName(1) cmsg = cms.getMessageQueue(sz_queue,"",0) cms.addselector(sz_queue, "topic='chat'" ) do while 1 < 2 //CtsComponents_Messageseq seq cseq = cmsg.receive( 0, 30 ) For i = 1 to UpperBound(cseq.item) cm = cseq.item[i] arg_notify.post of_notify( cm.Text ) after = cm.key Next loop return 1Multi-Threading in PowerBuilder: Multi-Threading in PowerBuilderPushed Messages: Pushed Messages Receiving messages that are pushed from the message service’s receive() method is straightforward. Code a component with an onmessage() method with the following signature: Return [none] onmessage( ctscomponents_message msg ) Pushed Messages: Pushed Messages You can create a new component and add the onmessage() method or you can create a component that implements an existing interface In this example, we’ll add logic to the onmessage() method that writes to the log and indicates when the component is calledPushed Messages: Pushed Messages It’s important to note that if you code a custom component that does not implement CstComponent/MessageListener, you must add this interface to your component using Jaguar Manager (Figure 12). The custom interface has the component’s actual IDL; you must add the MessageListener IDL Pushed Messages: Pushed Messages After creating and deploying the component, you must go into Jaguar Manager and configure the message queue to listen for messages. Under Message Service you can configure a new queue. Do this by right clicking on Configured Queues and selecting New. Message flow: Message flow Chat Client I Message Service Pull Messages Publish Message Push Messages EAServer Chat Client II n_messagelistener Client SideTaking it one Step Further: Taking it one Step Further Keeping track of who’s connected Sending messages to selected users Receiving messages from selected usersNew Getting more Help: New Getting more Help Mentoring New PowerBuilder 9 Book Internet and Distributed Application Development EAServer API Interface EAServer on-line help ForumsNew Getting more Help: New Getting more Help Sybase Tools Seminar April 2004 Minneapolis, MN Over 150 Attendees Six Sessions Panel Discussion with all experts and Sybase product managers http://www.powerobjects.com/seminarQuestions: QuestionsContact PowerObjects: Contact PowerObjects Send E-mail and Questions: dean@powerobjects.com Visit our Web-site: www.powerobjects.com Call Us: Office (612) 339-3355Grab one of my business card: Grab one of my business card Dean Jones Chief Executive Officer www.powerobjects.com 401 2nd Ave. S. Suite 843 Minneapolis, MN 55401 Office 612.339.3355 cell 612.701.4017 fax 612.339.4433 dean@powerobjects.com You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
EAS306 Eagle Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 426 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: November 21, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript EAS306 Building a Chat Server with EAServer and PowerBuilder: EAS306 Building a Chat Server with EAServer and PowerBuilder Dean Jones [TeamSybase] CEO of PowerObjects dean@powerobjects.com (612) 339-3355Who We Are…: Who We Are… PowerObjects Multi-Million dollar consulting company Sybase Consulting Partner Value Added reseller Premier consulting partner Custom Solution Provider Specialize in EAServer and Web Development Offer Web application hosting Certified Developers staff PowerBuilder, Java and Microsoft Certifies Member of Team SybaseOverview: Overview Building a Chat server using PowerBuilder and EAServer Using Java Message Service Publishing Messages Subscribing to Messages PowerBuilder Components Pushed messages onMessage Event Taking it one step furtherMessage Service: Message Service EAServer’s message service provides a powerful means by which to leverage multiple threads in your distributed applications Message Service: Message Service The message service provides queues for message consumers Allows message producers to send messages to specified queues (point-to-point messaging) Publish messages with specified topics that may be of interest to registered consumers (publish/subscribe messaging) There are two parts to the message service A Publisher A ConsumerMessage Service: Message ServicePublishing Messages: Publishing Messages To publish a message, there are three steps: Create a proxy for message service Populate the message PublishPowerBuilder Proxy: PowerBuilder Proxy Before you can send a message to the queue you must generate MessageService Proxy NOTE: The objects created will have an issue with wchar To fix you must edit the source and replace wchar data type with String data typePopulate the Message: Populate the Message A message is a structure of information to send to the serverPublish: Publish Publish a message with the specified message topic. A copy of this message will be sent to the queues for all consumers who have registered a message selector that returns TRUE when applied to this message void publish ( in string topic, in CtsComponents::Message msg, in long options );Chat Application: Chat Application You type a message into a single line edit and send when the user clicks Send.Chat Application: Chat ApplicationConsuming Messages: Consuming Messages To retrieve messages, there are two options: First is to pull messages from a given queue Second option is to let the message service push messages EAServer cannot push messages to a PowerBuilder client application, it can only push messages to PowerBuilder component EAServer can push messages to a Java client Consuming Messages: Consuming Messages Consumers of messages can either pull messages or have them pushed. There are three steps to pulling messages: Connect to the Message Service Specify a Queue and a Topic Receive messages To be a consumer of pushed messages, three steps must be taken: Implement Message Listener Code the onMessage event Register the receiving component using code or message service manager Connect to Message Service: Connect to Message Service ctsComponents_MessageService cms ctscomponents_messageseq cseq ctscomponents_messagequeue cmsg ctscomponents_message cm ctscomponents_messagekey after string sz_queue int i connection c c = CREATE connection c.application = "" c.location = "iiop://jones-dean:9000" c.userid = "jagadmin" c.password = "sarah" c.driver = "jaguar" c.ConnectToServer() c.CreateInstance(cms, "CtsComponents/MessageService") Receive Messages: Receive Messages sz_queue = cms.getUniqueName(1) cmsg = cms.getMessageQueue(sz_queue,"",0) cms.addselector(sz_queue, "topic='chat'" ) do while 1 < 2 //CtsComponents_Messageseq seq cseq = cmsg.receive( 0, 30 ) For i = 1 to UpperBound(cseq.item) cm = cseq.item[i] arg_notify.post of_notify( cm.Text ) after = cm.key Next loop return 1Multi-Threading in PowerBuilder: Multi-Threading in PowerBuilderPushed Messages: Pushed Messages Receiving messages that are pushed from the message service’s receive() method is straightforward. Code a component with an onmessage() method with the following signature: Return [none] onmessage( ctscomponents_message msg ) Pushed Messages: Pushed Messages You can create a new component and add the onmessage() method or you can create a component that implements an existing interface In this example, we’ll add logic to the onmessage() method that writes to the log and indicates when the component is calledPushed Messages: Pushed Messages It’s important to note that if you code a custom component that does not implement CstComponent/MessageListener, you must add this interface to your component using Jaguar Manager (Figure 12). The custom interface has the component’s actual IDL; you must add the MessageListener IDL Pushed Messages: Pushed Messages After creating and deploying the component, you must go into Jaguar Manager and configure the message queue to listen for messages. Under Message Service you can configure a new queue. Do this by right clicking on Configured Queues and selecting New. Message flow: Message flow Chat Client I Message Service Pull Messages Publish Message Push Messages EAServer Chat Client II n_messagelistener Client SideTaking it one Step Further: Taking it one Step Further Keeping track of who’s connected Sending messages to selected users Receiving messages from selected usersNew Getting more Help: New Getting more Help Mentoring New PowerBuilder 9 Book Internet and Distributed Application Development EAServer API Interface EAServer on-line help ForumsNew Getting more Help: New Getting more Help Sybase Tools Seminar April 2004 Minneapolis, MN Over 150 Attendees Six Sessions Panel Discussion with all experts and Sybase product managers http://www.powerobjects.com/seminarQuestions: QuestionsContact PowerObjects: Contact PowerObjects Send E-mail and Questions: dean@powerobjects.com Visit our Web-site: www.powerobjects.com Call Us: Office (612) 339-3355Grab one of my business card: Grab one of my business card Dean Jones Chief Executive Officer www.powerobjects.com 401 2nd Ave. S. Suite 843 Minneapolis, MN 55401 Office 612.339.3355 cell 612.701.4017 fax 612.339.4433 dean@powerobjects.com