<commit_before># NATS

EventMachine based Publish-Subscribe Messaging that just works.

## Supported Platforms

This gem currently works on the following Ruby platforms:

- MRI 1.8 and 1.9 (Performance is best on 1.9.2)
- Rubinius
- JRuby (should work)

## Usage

    require "nats/client"

    NATS.start do

      # Simple Subscriber
      NATS.subscribe('foo') { |sub, msg| puts "Msg received on [#{sub}] : '#{msg}' }

      # Wildcard Subscriptions

      # '*" matches any token
      NATS.subscribe('foo.*.baz') { |sub, msg| puts "Msg received on [#{sub}] : '#{msg}' }

      # '>" can only be last token, and matches to any depth
      NATS.subscribe('foo.>') { |sub, msg| puts "Msg received on [#{sub}] : '#{msg}' }

      # Simple Publisher
      NATS.publish('foo.bar.baz', 'Hello World!')

      # Publish with closure, callback fires when server has processed the message
      NATS.publish('foo', 'You done?') { puts 'msg processed!' }<commit_msg>Added getting started<commit_after># NATS

EventMachine based Publish-Subscribe Messaging that just works.

## Supported Platforms

This gem currently works on the following Ruby platforms:

- MRI 1.8 and 1.9 (Performance is best on 1.9.2)
- Rubinius
- JRuby (should work)

## Getting Started

    rake geminstall
    cd ./examples
    pub foo 'Hello World!'

## Usage
   
    require "nats/client"

    NATS.start do

      # Simple Subscriber
      NATS.subscribe('foo') { |sub, msg| puts "Msg received on [#{sub}] : '#{msg}' }

      # Wildcard Subscriptions

      # '*" matches any token
      NATS.subscribe('foo.*.baz') { |sub, msg| puts "Msg received on [#{sub}] : '#{msg}' }

      # '>" can only be last token, and matches to any depth
      NATS.subscribe('foo.>') { |sub, msg| puts "Msg received on [#{sub}] : '#{msg}' }

      # Simple Publisher
      NATS.publish('foo.bar.baz', 'Hello World!')

      # Publish with closure, callback fires when server has processed the message
      NATS.publish('foo', 'You done?') { puts 'msg processed!' }
{'fraction_non_alphanumeric': 0.1383242439266237, 'fraction_numerical': 0.006941001487357461, 'mean_word_length': 3.011928429423459, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5138126', 'n_tokens_mistral': 651, 'n_tokens_neox': 614, 'n_words': 220}