Overview | Package | Class
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.log4jfugue
Class MessageReceiver

Listens for log messages to process. This is the class that does the string searches to determine that a particular message of interest has been seen. When this happens the count of the associated instrument is incremented. The message can arrive from a variety of sources such as a live feed or a replay of an existing log file. The actual source does not matter to this class. A recent change to this class has been to replace the native java string search with an MIT based BoyerMoorHorspool string search that is up to 10x faster.

author:
  btarbox

Field Summary
`int` | `counterIndex`
`HashMap` | `instrumentMessageMap`
`Logger` | `log`
`Properties` | `messages`
`Music` | `music`
`BufferedReader` | `reader`
`StringSearch` | `searcher`
`Statistics` | `statistics`
`HashMap` | `stringSearchMap`

Constructor Summary
`MessageReceiver()`

Method Summary
`Set` | `getInstrumentList()` Let other classes, like the RhythmSoundBuilder get our list of instruments
`void` | `initializeMessagemap(Properties messages)`
`void` | `processAMessage(String searchMe)` this takes a line of text (from wherever) and sees if it matches any of our target string.
`void` | `processAMessageFaster(String searchMe)`
`void` | `run()` Build the music string to send to JFugue
`void` | `setMessages(Properties messages)` Injected by Spring, after music is set.
`void` | `setMusic(Music music)` Used by Spring DI to tell class what the main Music object is
`void` | `setReader(Reader reader)` Used by Spring DI to tell class where to get the message Reader
`void` | `setStatistics(Statistics statistics)`
`void` | `swapCounters()` There are two message accumulators, one is being added to and the other is being played from.

Constructor Detail

### MessageReceiver

    public MessageReceiver()

Method Detail

### getInstrumentList

    public Set getInstrumentList()

  Let other classes, like the RhythmSoundBuilder get our list of instruments

### initializeMessagemap

    void initializeMessagemap(Properties messages)

### processAMessage

    void processAMessage(String searchMe)

  this takes a line of text (from wherever) and sees if it matches any of our target string. If the system has any processing bottleneck it would be here
  param:
    searchMe
  deprecated:
    use processAMessageFaster instead

### processAMessageFaster

    void processAMessageFaster(String searchMe)

### run

    public void run()

  Build the music string to send to JFugue

### setMessages

    public void setMessages(Properties messages)

  Injected by Spring, after music is set. The properties object contains the definitions of the strings to look for and the instruments to associate with them
  param:
    messages

### setMusic

    public void setMusic(Music music)

  Used by Spring DI to tell class what the main Music object is
  param:
    music

### setReader

    public void setReader(Reader reader)

  Used by Spring DI to tell class where to get the message Reader
  param:
    reader

### setStatistics

    public void setStatistics(Statistics statistics)

### swapCounters

    public void swapCounters()

  There are two message accumulators, one is being added to and the other is being played from. This method allows the player to swap the accumulators