Current Page:
NeXtMidas Training
Primitives
Lab 8
Instructions
|
|
- Lab 8:
- For this lab you are given a primitive that is supposed to fan messages out to 0 or more
listeners. Your job will be to fill in the
processMessage(..) method so that
is does this.
- Files (be sure to save these with the correct names):
- Use
UPDATE to add the primitive to the command dictionary. It takes in 0+ parameters.
- Whenever a message is received the primitive should send a copy of the message
on to each of the message handlers listed on the command line.
- Use the test macro to test it out.
- Hint: This lab requires you to fill in the
processMessage(..) method. You do not need to add code anywhere else in
the file, all is done for you.
Don't Make This Mistake: |
Do not give the message passed into processMessage(..) to MQ.put(..)
doing so can cause one of the following problems: (1) infinite loop if msg.to is
still set to the current primitive, (2) sharing of the Message object between
multiple primitives simultaneously (remember, the different primitives process the message
in their own threads, if the same Message object is sent to multiple commands,
invalid messages may get processed due to the changing of msg.to between calls).
|
|
|
|