Search Results

Search found 24726 results on 990 pages for 'message passing'.

Page 15/990 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Passing data between the VirtualBox Host and the Guest

    - by Fat Bloke
    Here's a good question: "How can you figure out the VM name from within the VM itself?" While this data is not automatically available, the general purpose, and very powerful VirtualBox "GuestProperty" APIs can be used from the host and guest to pass arbitrary data, in key/value pairs format, in and out of the guest. Note that this does require that the VirtualBox Guest Additions have been installed in the guest. To play with this, try using the "VBoxManage" command line on your VirtualBox host machine, and "VBoxControl" in the guest. Host syntax VBoxManage guestproperty get <vmname>|<uuid> <property> [--verbose] VBoxManage guestproperty set <vmname>|<uuid> <property> [<value> [--flags <flags>]] VBoxManage guestproperty enumerate <vmname>|<uuid> [--patterns <patterns>] VBoxManage guestproperty wait <vmname>|<uuid> <patterns> [--timeout <msec>] [--fail-on-timeout]   Guest syntax VBoxControl.exe guestproperty        get <property> [-verbose] VBoxControl.exe guestproperty        set <property> [<value> [-flags <flags>]] VBoxControl.exe guestproperty        enumerate [-patterns <patterns>] VBoxControl.exe guestproperty        wait <patterns>                                      [-timestamp <last timestamp>]                                      [-timeout <timeout in ms>  So to solve our problem above, we set the vm name in the Host system on an arbitrary key like this: $ VBoxManage guestproperty set "Windows 7 (x64)" /MyData/VMname "Windows 7 (x64)" And within the guest we can use: C:\Program Files\Oracle\VirtualBox Guest Additions>VBoxControl.exe guestproperty get /MyData/VMname Oracle VM VirtualBox Guest Additions Command Line Management Interface Version 4.1.14 (C) 2008-2012 Oracle Corporation All rights reserved. Value: Windows 7 (x64) The GuestProperty API is pretty powerful, so for the interested, get more info in the User Manual. - FB 

    Read the article

  • Passing an objects rotation down through its children

    - by MintyAnt
    In my topdown 2d game you have a player with a sword, like an old Zelda game. The sword is a seperate entity, and its collision box "rotates" around the player like an orbit, but always follows the player wherever he goes. The player and sword both have a vector2 heading. The sword is a weapon object that is attached to the character. In order to allow swinging in a direction, I have the following property inside sword (RotateCopy returns a copy of the mHeading after rotation) public Vector2 Heading { get { return mHeading.RotateCopy(mOwner.Rotation); } } This seems a bit messy to me, and slower than it could be. Is there a better way to "translate" the base/owner component rotations through to whatever component I am using, like this sword? Would using a rotation MATRIX be better? (Curretnly rotates by sin/cos) If so, how can I "add" up the matrices? Thank you.

    Read the article

  • FORBES.COM: Oracle's message is loud & clear – “we've got the cloud”

    - by Richard Lefebvre
    In a two-part series on Oracle's cloud strategy, Bob Evans reports on the October 4 meeting where Wall Street analysts questioned Mark Hurd and Safra Catz about the company's positioning for the shift to cloud computing. Check out Bob's related Forbes.com piece "The Dumbest Idea of 2013," in response to the preposterous chatter that Larry Ellison and Oracle don't "get" the cloud. His powerful six-point argument unravels our competitors' spin. Read the "Dumbest Idea."

    Read the article

  • Passing variables from PHP to C++

    - by Alex
    I’m new to this so I’m sorry if my question is trivial. I have the following situation: I need to call a program from PHP and pass some vars and/or sets of key-value pairs to it. Now, my question is: how do I pass these vars, through arguments to the called function (e.g. exec("/path/to/program flag1 flag2 [key1=A,key2=B]");)? Or is there a better method to achieve this? Somebody suggested me to write them into a txt file and pass the path to it to as an argument instead (e.g. exec("/path/to/program path_to_txt_file);), but I’m not to excited about this method.

    Read the article

  • Forbes.com: Oracle's message is Loud & Clear – “We’ve Got The Cloud”

    - by Cinzia Mascanzoni
    In a two-part series on Oracle's cloud strategy, Bob Evans reports on the October 4 meeting where Wall Street analysts questioned Mark Hurd and Safra Catz about the company's positioning for the shift to cloud computing. Access the article and read the Q&A exchanges between the analysts and Hurd and Catz. And then check out Bob's related Forbes.com piece "The Dumbest Idea of 2013," in response to the preposterous chatter that Larry Ellison and Oracle don't "get" the cloud. His powerful six-point argument unravels our competitors' spin. Go to the two-part strategy article. Read the "Dumbest Idea." Follow Bob on Twitter as he frequently updates his Oracle Voice column on Forbes.com.

    Read the article

  • Passing variable from SharePoint to external website

    - by TechDaddyK
    My company has a SharePoint site that is administered by the IT department (versus the Web Developer... go figure!). We have partnered with a vendor that has built a site for our staff to order customized stationery, etc. I need to create a link on the SharePoint site that will take the user to the external site but identify them individually. The vendor is suggesting this format: https://www.VENDORSITE.com/UI/Profile.hcf?id=a02b8106-4115-47cd-bca7-ce4dd447ef89&username=<user name>&password=<password>&name1=<first name>&name2=<last name>&email=<email> Here's the problem: I don't know how to pass that info, or even a single variable, from the SharePoint site to the external site. I would appreciate ANY suggestions.

    Read the article

  • Syntax of passing lambda causing hair loss (pulling out)

    - by Astara
    Right now, I'm working on refactoring a program that calls its parts by polling to a more event-driven structure. I've created sched and task classes with the sced to become a base class of the current main loop. The tasks will be created for each meter so they can be called off of that instead of polling. Each of the events main calls are a type of meter that gather info and display it. When the program is coming up, all enabled meters get 'constructed' by a main-sub. In that sub, I want to store off the "this" pointer associated with the meter, as well as the common name for the "action routine. void MeterMaker::Meter_n_Task (Meter * newmeter,) { push(newmeter); // handle non-timed draw events Task t = new Task(now() + 0.5L); t.period={0,1U}; t.work_meter = newmeter; t.work = [&newmeter](){newmeter.checkevent();};<<--attempt at lambda t.flags = T_Repeat; t.enable_task(); _xos->sched_insert(t); } A sample call to it: Meter_n_Task(new CPUMeter(_xos, "CPU ")); 've made the scheduler a base class of the main routine (that handles the loop), and I've tried serveral variations to get the task class to be a base of the meter class, but keep running into roadblocks. It's alot like "whack-a-mole" -- pound in something to fix something one place, and then a new probl pops out elsewhere. Part of the problem, is that the sched.h file that is trying to hold the Task Q, includes the Task header file. The task file Wants to refer to the most "base", Meter class. The meter class pulls in the main class of the parent as it passes a copy of the parent to the children so they can access the draw routines in the parent. Two references in the task file are for the 'this' pointer of the meter and the meter's update sub (to be called via this). void *this_data= NULL; void (*this_func)() = NULL; Note -- I didn't really want to store these in the class, as I wanted to use a lamdba in that meter&task routine above to store a routine+context to be used to call the meter's action routine. Couldn't figure out the syntax. But am running into other syntax problems trying to store the pointers...such as g++: COMPILE lsched.cc In file included from meter.h:13:0, from ltask.h:17, from lsched.h:13, from lsched.cc:13: xosview.h:30:47: error: expected class-name before ‘{’ token class XOSView : public XWin, public Scheduler { Like above where it asks for a class, where the classname "Scheduler" is. !?!? Huh? That IS a class name. I keep going in circles with things that don't make sense... Ideally I'd get the lamba to work right in the Meter_n_Task routine at the top. I wanted to only store 1 pointer in the 'Task' class that was a pointer to my lambda that would have already captured the "this" value ... but couldn't get that syntax to work at all when I tried to start it into a var in the 'Task' class. This project, FWIW, is my teething project on the new C++... (of course it's simple!.. ;-))... I've made quite a bit of progress in other areas in the code, but this lambda syntax has me stumped...its at times like thse that I appreciate the ease of this type of operation in perl. Sigh. Not sure the best way to ask for help here, as this isn't a simple question. But thought I'd try!... ;-) Too bad I can't attach files to this Q.

    Read the article

  • Why do I get the message "program not found" when running "mal" for Latex

    - by maclin
    just started using Ubuntu (11.10 oneiric). It is running on a virtual machine. I used to use SuSE. However, SuSE is now with Novel, which goes hand in hand with Microsoft. So now shifted to Ubuntu. For documentation I use LaTeX and installed a package. This package uses a pre-processer (it is called "mal"). I ran the textconfig rehash command as required, but when I try to run the program, I get a "program not found" error. I am guessing that it is not in my path. (a sudo did not help) Any idea?

    Read the article

  • Unable to log in due to freeze, occasional error message

    - by Xianlin Xiong
    I'm new to Ubuntu. And I have some problems now. I downloaded Ubuntu 11.10 and burned it onto a CD. Then I load it in my conputer, it's easy. But when I finished those and restarted the computer, the problem comes: After I choose to log in the Ubuntu system,the screen stays in pink, and it can't jump into (about 30 min), and then I have no choices but to press Ctrl+Alt+Del to reboot. Another time I choose Ubuntu to log in, it shows on the screen that "BusyBox v1.18.4 ...... built-in shell ...... initramfs". However the Live CD works very well. What’s more, there is a Windows 7 partition on the hard drive. (Windows 7 is also okay.) But I leave more than 20GB on the hard drive to Ubuntu. When I installed Ubuntu, I only made two partitions (swap and /). I don’t know where the problems happened and how to deal with them. And I hope someone can help me out with the troubles.

    Read the article

  • Passing class names or objects?

    - by nischayn22
    I have a switch statement switch ( $id ) { case 'abc': return 'Animal'; case 'xyz': return 'Human'; //many more } I am returning class names,and use them to call some of their static functions using call_user_func(). Instead I can also create a object of that class, return that and then call the static function from that object as $object::method($param) switch ( $id ) { case 'abc': return new Animal; case 'xyz': return new Human; //many more } Which way is efficient? To make this question broader : I have classes that have mostly all static methods right now, putting them into classes is kind of a grouping idea here (for example the DB table structure of Animal is given by class Animal and so for Human class). I need to access many functions from these classes so the switch needs to give me access to the class

    Read the article

  • Apple Gets the Message About Centralized Notifications on Mobile

    - by ultan o'broin
    Yep, looks like iOS5 introduces a centralized messaging system: the Notification Center. Wonder where they got that idea from? Seriously, way to go though; this matches and probably betters what I really like about Android’s notifications system. I’ll have to check it out myself, though. Application UX's own research confirmed the centralized approach as something users wanted in research last year. This feature will really help the iOS in the enterprise user market too. Up to now, iOS is pretty dismal in the notifications space IMO.

    Read the article

  • Getting error message when trying to start a virtual machine

    - by Sunil J
    I have been using VMWare on Windows for a long time. But after a long wait, I moved to VirtualBox on Ubuntu 11.10. I installed Ubuntu, 32 Bit, installed all available updates and installed Virtual Box. When I try to create a new Windows installation inside VirtualBox, I got the following error messages. 1st error dialogue VirtualBox - Error Failed to open a session for the virtual machine Windows XP.<br> The virtual machine '**Windows XP**' has terminated unexpectedly during startup with exit code 1.<p> Details<p> Result Code: <br> NS_ERROR_FAILURE (0x80004005)<br> Component: <br> Machine<br> Interface: <br> IMachine {5eaa9319-62fc-4b0a-843c-0cb1940f8a91}<p> 2nd error dialogue **Virtualbox - Error in suplibOsinit**<br> **Kernal driver not installed (rc--1908)**<br> Please install the virtualbox-dkmbs package and execute 'modprobe vboxdrv' as root.<p> Steps I tried I have already tried reinstalling VirtualBox. Google result seem to indicate the the problem happens due to Kernel updates. Is there anyway I can get this working? I need this for malware analysis and if VirtualBox is going to crash on me all the time, then I won't be able to use Ubuntu for work. Output to dpkg -l | grep virtual server rc virtualbox 4.1.2-dfsg-1ubuntu1 x86 virtualization solution - base binaries rc virtualbox-qt 4.1.2-dfsg-1ubuntu1 x86 virtualization solution - Qt based user interface cute 'modprobe vboxdrv' as root.<p>

    Read the article

  • I cannot boot Ubuntu from WUBI install with windows 7, get an error message every time

    - by Tom
    i have tried several times to install ubuntu using wubi, i can't use a disc as i have a notebook computer and there is no optical drive. the download and installation all seem to work well but whenever i try to boot ubuntu at the windows 7/ubuntu menu it comes up with this error screen. I have used both the C: drive and the D: drive to install Ubuntu several times each, it's always unsuccessful. "Windows has failed to start. a recent hardware or software change might be the cause. To fix the problem: Insert your windows installation disc and restart your computer Choose your language settings and then click 'next' Click repair your computer. If you do not have this disc, contact your system administrator or computer manufacturer for assistance. File: \ubuntu\winboot\wubildr.mbr Status: 0xc000000F Info: The selected entry could not be loaded because the application is missing or corrupt." I use an ASUS x501a with windows 7. What do i do to fix this? I want to be able to dual boot Windows 7 and ubuntu. Thanks a lot :)

    Read the article

  • Page Navigation and Passing, Sharing and Retaining Data in Windows Phone 7

    Page navigation would seem to be an advanced Silverlight programming topic, and a topic that applies only to Silverlight programming rather than XNA programming. However, there are issues involved with navigation that are related to the very important topic of tombstoning, which is what happens to your Windows Phone 7 application when the user navigates to another application through the phone’s Start screen.

    Read the article

  • Ubuntu 11.10 error message at startup after clean install

    - by user999687
    I have just installed Ubuntu 11.10 (did a fresh install and erased 11.04). After the reboot it appeared a log on the screen, saying all the starting services on the left and [OK] on the right. However, two particular entries, starting automatic crash report installation and starting restore sound card(s') mixer state(s) were set on [FAIL]. After that, Ubuntu did not boot. Is there any way that i can skip those two entries and boot Ubuntu?

    Read the article

  • Android app, No error message but has stopped unexpectedly [migrated]

    - by user74722
    Does anyone know what is my problem. I do not have any compile error messages however when i run the app it crashes and stops unexpectedly. Here is my codes. Thank you in advance. ListView l ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_final_project); String arr[]={"Red","Green","Blue","Yellow","Cyan"}; l=(ListView) findViewById(R.id.listView1); ArrayAdapter<String> adapter=new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, arr); l.setAdapter(adapter); Button buttonOne = (Button) findViewById(R.id.button1); buttonOne.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ setContentView(R.layout.layout_save); // setContentView(R.layout.activity_final_project); //startActivity(new Intent("com.example.finalproject.layout_save")); } }); }

    Read the article

  • MS Access 2003 - Message Box: How can I answer "ok" automatically through code

    - by Justin
    So a couple silly questions: If I include this in some event: MsgBox " ", vbOkOnly, "This little message box" could I then with some more code turn around and 'click the ok button. So that basically the message boox automatically pops up, and then automatically goes away? I know its silly because you want to know, why do you want the message box then..... well a) i just want to know if you can do that, and what would be the command b) i have some basic shapes (shape objects) that are made visible when the message box appears. But without having the message box there, there is no temporary disruption of code while waiting for the button to be clicked, and therefor those pretty image objects being made visible does take effect on the the form. So I really do not need the message box, just the temp disruption that shows the objects. Thanks!

    Read the article

  • WCF Message Debugging on Custom Binding

    - by Programming Hero
    I've created a custom binding in WCF for a custom MessageEncoder to allow messages to be written as XML using a wider range of encodings than WCF supports out of the box. The encoder appears to be working and I am able to send and receive messages, but I want to verify that the XML message being written is exactly as required by the service I am trying to consume. I've turned on message logging for WCF using the diagnostic trace listeners to output the messages sent and received over the wire to a log file. Unfortunately, for calls using my encoder, the message is displayed as ... stream ... EDIT: I don't think it's anything to do with my custom encoding. I have experimented with my custom binding a little, switching to using the built-in text encoding and http transport. I still don't get a message body logged in the message trace. Is there anything that needs to be specified within a custom binding to enable message logging?

    Read the article

  • service broker message process order

    - by Blootac
    Everywhere I read says that messages handled by the service broker are processed in the order that they arrive, and yet if you create a table, message type, contract, service etc , and on activation have a stored proc that waits for 2 seconds and inserts the msg into a table, set the max queue readers to 5 or 10, and send 20 odd messages I can see in the table that they are inserted out of order even though when I insert them into the queue and look at the contents of the queue I can see that the messages are all in the right order. Is it due to the delay waitfor waiting for the nearest second and each thread having different subsecond times and then fighting for a lock or something? The reason i've got a delay in there is to simulate delays with joins etc Thanks demo code: --create the table and service broker CREATE TABLE test ( id int identity(1,1), contents varchar(100) ) CREATE MESSAGE TYPE test CREATE CONTRACT mycontract ( test sent by initiator ) GO CREATE PROCEDURE dostuff AS BEGIN DECLARE @msg varchar(100); RECEIVE TOP (1) @msg = message_body FROM myQueue IF @msg IS NOT NULL BEGIN WAITFOR DELAY '00:00:02' INSERT INTO test(contents)values(@msg) END END GO ALTER QUEUE myQueue WITH STATUS = ON, ACTIVATION ( STATUS = ON, PROCEDURE_NAME = dostuff, MAX_QUEUE_READERS = 10, EXECUTE AS SELF ) create service senderService on queue myQueue ( mycontract ) create service receiverService on queue myQueue ( mycontract ) GO --********************************************************** --now insert lots of messages to the queue DECLARE @dialog_handle uniqueidentifier BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>1</test>'); BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>2</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>3</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>4</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>5</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>6</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>7</test>')

    Read the article

  • C# Debug.Assert-s use the same error message. Should I promote it to a static variable?

    - by Hamish Grubijan
    I love Asserts but not code duplication, and in several places I use a Debug.Assert which checks for the same condition like so: Debug.Assert(kosherBaconList.SelectedIndex != -1, "An error message along the lines - you should not ever be able to click on edit button without selecting a kosher bacon first."); This is in response to an actual bug, although the actual list does not contain kosher bacon. Anyhow, I can think of two approaches: private static readonly mustSelectKosherBaconBeforeEditAssertMessage = "An error message along the lines - you should not ever be able to " + "click on edit button without selecting a something first."; ... Debug.Assert( kosherBaconList.SelectedIndex != -1, mustSelectKosherBaconBeforeEditAssertMessage) or: if (kosherBaconList.SelectedIndex == -1) { AssertMustSelectKosherBaconBeforeEdit(); } ... [Conditional("DEBUG")] private void AssertMustSelectKosherBaconBeforeEdit() { // Compiler will optimize away this variable. string errorMessage = "An error message along the lines - you should not ever be able to " + "click on edit button without selecting a something first."; Debug.Assert(false, errorMessage); } or is there a third way which sucks less than either one above? Please share. General helpful relevant tips are also welcome.

    Read the article

  • Where should I put validation code?

    - by D Lawson
    I'm creating interfaces and abstract classes that represent a messaging framework for short text-based messages like SMS, email, twitter, xml, etc.. and I was wondering where I should put the message validation code. The thing is that I am only writing the superclasses and interfaces, so I'm not putting the actual implementation in, I'll just put the hooks in that allow others to validate the content of the messages. The way I see it, I could do it several ways: in the abstract superclass "Message", have an abstract method 'isValid'. A variation on this would be to have isValid be called when the Message constructor is called, throwing a MalformedMessageException if the message is formatted incorrectly. in the transport layer, immediately before sending, validate the message. I would have a send(Message) method that calls an isValid(Message) method immediately before it sends. have a singleton message validator with a static method isValid(Message) that is called at some point. I'm sure there are other options that I'm missing. Currently, I'm leaning towards the first one, but it doesn't feel right to me to have validation code in what should be a domain object.

    Read the article

  • Sender's Sendmail says "stat=Sent" but recipent doesn't receive the message

    - by user44774
    Guys, I am trying to figure out why sendmail is saying that it sends out an email but I actually never get it. This is from the logs when the email is being sent out: I have replaced the email address with some fake address and I have also replaced the name of the server with a fake hostname. The most significant point of this information from the logs is that it shows that the "Message was accepted for delivery". Do you guys have any suggestions as to why it seems like the message goes out but I never get the actual email? Jun 2 14:34:40 server sendmail[9668]: o52IYeSi009668: --- 250 2.0.0 o52IYeSi009668 Message accepted for delivery Jun 2 14:34:40 server sendmail[9667]: o52IYe9I009667: [email protected], ctladdr=rick (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30058, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o52IYeSi009668 Message accepted for delivery) Jun 2 14:34:40 server sendmail[9668]: o52IYeSj009668: <-- QUIT Jun 2 14:34:40 server sendmail[9668]: o52IYeSj009668: --- 221 2.0.0 server.server.com closing connection Jun 2 14:34:41 server sendmail[9670]: o52IYeSi009668: SMTP outgoing connect on [192.168.1.9] Jun 2 14:34:41 server sendmail[9670]: o52IYeSi009668: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=120368, relay=mailhost.worldnet.att.net. [207.115.11.17], dsn=5.1.1, stat=User unknown Jun 2 14:34:42 server sendmail[9670]: o52IYeSi009668: o52IYgSi009670: DSN: User unknown Jun 2 14:34:42 server sendmail[9670]: o52IYgSi009670: to=<[email protected]>, **delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31625, dsn=2.0.0,** ***stat=Sent*****

    Read the article

  • JMS Step 3 - Using the QueueReceive.java Sample Program to Read a Message from a JMS Queue

    - by John-Brown.Evans
    JMS Step 3 - Using the QueueReceive.java Sample Program to Read a Message from a JMS Queue ol{margin:0;padding:0} .c18_3{vertical-align:top;width:487.3pt;border-style:solid;background-color:#f3f3f3;border-color:#000000;border-width:1pt;padding:0pt 5pt 0pt 5pt} .c20_3{vertical-align:top;width:487.3pt;border-style:solid;border-color:#ffffff;border-width:1pt;padding:5pt 5pt 5pt 5pt} .c19_3{background-color:#ffffff} .c17_3{list-style-type:circle;margin:0;padding:0} .c12_3{list-style-type:disc;margin:0;padding:0} .c6_3{font-style:italic;font-weight:bold} .c10_3{color:inherit;text-decoration:inherit} .c1_3{font-size:10pt;font-family:"Courier New"} .c2_3{line-height:1.0;direction:ltr} .c9_3{padding-left:0pt;margin-left:72pt} .c15_3{padding-left:0pt;margin-left:36pt} .c3_3{color:#1155cc;text-decoration:underline} .c5_3{height:11pt} .c14_3{border-collapse:collapse} .c7_3{font-family:"Courier New"} .c0_3{background-color:#ffff00} .c16_3{font-size:18pt} .c8_3{font-weight:bold} .c11_3{font-size:24pt} .c13_3{font-style:italic} .c4_3{direction:ltr} .title{padding-top:24pt;line-height:1.15;text-align:left;color:#000000;font-size:36pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}.subtitle{padding-top:18pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:24pt;font-family:"Georgia";padding-bottom:4pt} li{color:#000000;font-size:10pt;font-family:"Arial"} p{color:#000000;font-size:10pt;margin:0;font-family:"Arial"} h1{padding-top:0pt;line-height:1.15;text-align:left;color:#888;font-size:24pt;font-family:"Arial";font-weight:normal} h2{padding-top:0pt;line-height:1.15;text-align:left;color:#888;font-size:18pt;font-family:"Arial";font-weight:normal} h3{padding-top:0pt;line-height:1.15;text-align:left;color:#888;font-size:14pt;font-family:"Arial";font-weight:normal} h4{padding-top:0pt;line-height:1.15;text-align:left;color:#888;font-size:12pt;font-family:"Arial";font-weight:normal} h5{padding-top:0pt;line-height:1.15;text-align:left;color:#888;font-size:11pt;font-family:"Arial";font-weight:normal} h6{padding-top:0pt;line-height:1.15;text-align:left;color:#888;font-size:10pt;font-family:"Arial";font-weight:normal} This post continues the series of JMS articles which demonstrate how to use JMS queues in a SOA context. In the first post, JMS Step 1 - How to Create a Simple JMS Queue in Weblogic Server 11g we looked at how to create a JMS queue and its dependent objects in WebLogic Server. In the previous post, JMS Step 2 - Using the QueueSend.java Sample Program to Send a Message to a JMS Queue I showed how to write a message to that JMS queue using the QueueSend.java sample program. In this article, we will use a similar sample, the QueueReceive.java program to read the message from that queue. Please review the previous posts if you have not already done so, as they contain prerequisites for executing the sample in this article. 1. Source code The following java code will be used to read the message(s) from the JMS queue. As with the previous example, it is based on a sample program shipped with the WebLogic Server installation. The sample is not installed by default, but needs to be installed manually using the WebLogic Server Custom Installation option, together with many, other useful samples. You can either copy-paste the following code into your editor, or install all the samples. The knowledge base article in My Oracle Support: How To Install WebLogic Server and JMS Samples in WLS 10.3.x (Doc ID 1499719.1) describes how to install the samples. QueueReceive.java package examples.jms.queue; import java.util.Hashtable; import javax.jms.*; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; /** * This example shows how to establish a connection to * and receive messages from a JMS queue. The classes in this * package operate on the same JMS queue. Run the classes together to * witness messages being sent and received, and to browse the queue * for messages. This class is used to receive and remove messages * from the queue. * * @author Copyright (c) 1999-2005 by BEA Systems, Inc. All Rights Reserved. */ public class QueueReceive implements MessageListener { // Defines the JNDI context factory. public final static String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory"; // Defines the JMS connection factory for the queue. public final static String JMS_FACTORY="jms/TestConnectionFactory"; // Defines the queue. public final static String QUEUE="jms/TestJMSQueue"; private QueueConnectionFactory qconFactory; private QueueConnection qcon; private QueueSession qsession; private QueueReceiver qreceiver; private Queue queue; private boolean quit = false; /** * Message listener interface. * @param msg message */ public void onMessage(Message msg) { try { String msgText; if (msg instanceof TextMessage) { msgText = ((TextMessage)msg).getText(); } else { msgText = msg.toString(); } System.out.println("Message Received: "+ msgText ); if (msgText.equalsIgnoreCase("quit")) { synchronized(this) { quit = true; this.notifyAll(); // Notify main thread to quit } } } catch (JMSException jmse) { System.err.println("An exception occurred: "+jmse.getMessage()); } } /** * Creates all the necessary objects for receiving * messages from a JMS queue. * * @param ctx JNDI initial context * @param queueName name of queue * @exception NamingException if operation cannot be performed * @exception JMSException if JMS fails to initialize due to internal error */ public void init(Context ctx, String queueName) throws NamingException, JMSException { qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY); qcon = qconFactory.createQueueConnection(); qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queue = (Queue) ctx.lookup(queueName); qreceiver = qsession.createReceiver(queue); qreceiver.setMessageListener(this); qcon.start(); } /** * Closes JMS objects. * @exception JMSException if JMS fails to close objects due to internal error */ public void close()throws JMSException { qreceiver.close(); qsession.close(); qcon.close(); } /** * main() method. * * @param args WebLogic Server URL * @exception Exception if execution fails */ public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Usage: java examples.jms.queue.QueueReceive WebLogicURL"); return; } InitialContext ic = getInitialContext(args[0]); QueueReceive qr = new QueueReceive(); qr.init(ic, QUEUE); System.out.println( "JMS Ready To Receive Messages (To quit, send a \"quit\" message)."); // Wait until a "quit" message has been received. synchronized(qr) { while (! qr.quit) { try { qr.wait(); } catch (InterruptedException ie) {} } } qr.close(); } private static InitialContext getInitialContext(String url) throws NamingException { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY); env.put(Context.PROVIDER_URL, url); return new InitialContext(env); } } 2. How to Use This Class 2.1 From the file system on Linux This section describes how to use the class from the file system of a WebLogic Server installation. Log in to a machine with a WebLogic Server installation and create a directory to contain the source and code matching the package name, e.g. span$HOME/examples/jms/queue. Copy the above QueueReceive.java file to this directory. Set the CLASSPATH and environment to match the WebLogic server environment. Go to $MIDDLEWARE_HOME/user_projects/domains/base_domain/bin  and execute . ./setDomainEnv.sh Collect the following information required to run the script: The JNDI name of the JMS queue to use In the WebLogic server console > Services > Messaging > JMS Modules > Module name, (e.g. TestJMSModule) > JMS queue name, (e.g. TestJMSQueue) select the queue and note its JNDI name, e.g. jms/TestJMSQueue The JNDI name of the connection factory to use to connect to the queue Follow the same path as above to get the connection factory for the above queue, e.g. TestConnectionFactory and its JNDI name e.g. jms/TestConnectionFactory The URL and port of the WebLogic server running the above queue Check the JMS server for the above queue and the managed server it is targeted to, for example soa_server1. Now find the port this managed server is listening on, by looking at its entry under Environment > Servers in the WLS console, e.g. 8001 The URL for the server to be passed to the QueueReceive program will therefore be t3://host.domain:8001 e.g. t3://jbevans-lx.de.oracle.com:8001 Edit Queue Receive .java and enter the above queue name and connection factory respectively under ... public final static String JMS_FACTORY="jms/TestConnectionFactory"; ... public final static String QUEUE="jms/TestJMSQueue"; ... Compile Queue Receive .java using javac Queue Receive .java Go to the source’s top-level directory and execute it using java examples.jms.queue.Queue Receive   t3://jbevans-lx.de.oracle.com:8001 This will print a message that it is ready to receive messages or to send a “quit” message to end. The program will read all messages in the queue and print them to the standard output until it receives a message with the payload “quit”. 2.2 From JDeveloper The steps from JDeveloper are the same as those used for the previous program QueueSend.java, which is used to send a message to the queue. So we won't repeat them here. Please see the previous blog post at JMS Step 2 - Using the QueueSend.java Sample Program to Send a Message to a JMS Queue and apply the same steps in that example to the QueueReceive.java program. This concludes the example. In the following post we will create a BPEL process which writes a message based on an XML schema to the queue.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >