# Pub/Sub in Distributed setup

**URL:** <https://www.ruby-forum.com/t/pub-sub-in-distributed-setup/62085>\
**Category:** Ruby\
**Created:** [May 31, 2006, 12:17pm UTC](https://www.ruby-forum.com/t/pub-sub-in-distributed-setup/62085 "2006-05-31T12:17:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/9de0a6/32.png) [@Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/u/Vinay_Kumar_Jaasti)\
**Post date:** [May 31, 2006, 12:17pm UTC](https://www.ruby-forum.com/t/pub-sub-in-distributed-setup/62085/1 "2006-05-31T12:17:58Z")

</div>

Hi,  
I want to implement RCR 198 in distributed environment.I wrote  
subscriber as  
follows

require ‘drb’  
DRb.start\_service()  
a = DRbObject.new(nil,‘druby://localhost:9000’)  
a.subscribe(:prof2 ) do |proxy|  
proxy.method1 #this is a private method accessed thru proxy  
end

But it is giving me unknown method error…please help

thanks  
----vinay

---

<div class="post-metadata">

**Author:** ![Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/9de0a6/32.png) [@Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/u/Vinay_Kumar_Jaasti)\
**Post date:** [May 31, 2006, 8:09pm UTC](https://www.ruby-forum.com/t/pub-sub-in-distributed-setup/62085/2 "2006-05-31T20:09:24Z")

</div>

On May 31, 2006, at 6:17 AM, Vinay Kumar Jaasti wrote:

> end
> 
> But it is giving me unknown method error…please help
> 
> thanks  
> ----vinay

Where’s the other half of your code? What does the object that you  
are connecting to look like?

---

<div class="post-metadata">

**Author:** ![Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/9de0a6/32.png) [@Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/u/Vinay_Kumar_Jaasti)\
**Post date:** [June 1, 2006, 6:19am UTC](https://www.ruby-forum.com/t/pub-sub-in-distributed-setup/62085/3 "2006-06-01T06:19:38Z")

</div>

class Abc \< Object  
def method1  
puts “in Method 1”  
end  
def method2  
puts “in method 2”  
end  
publish :prof, :method1  
publish :prof2, :method2  
end

where Object is implemented as in RCR198.  
and I bounded object to drb as

require ‘drb’  
require ‘PubSubServer’  
server = Abc.new  
DRb.start\_service(‘druby://localhost:9000’, server)  
DRb.thread.join

Now, the client(code given below) is not able to fiqure out what proxy  
is.How can i resolve this?

thanks  
–vinay

---

<div class="post-metadata">

**Author:** ![Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/9de0a6/32.png) [@Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/u/Vinay_Kumar_Jaasti)\
**Post date:** [June 3, 2006, 7:24am UTC](https://www.ruby-forum.com/t/pub-sub-in-distributed-setup/62085/4 "2006-06-03T07:24:14Z")

</div>

Sorry for the typo.It should be method2

---

<div class="post-metadata">

**Author:** ![Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/9de0a6/32.png) [@Vinay\_Kumar\_Jaasti](https://www.ruby-forum.com/u/Vinay_Kumar_Jaasti)\
**Post date:** [June 2, 2006, 8:49pm UTC](https://www.ruby-forum.com/t/pub-sub-in-distributed-setup/62085/5 "2006-06-02T20:49:06Z")

</div>

On Jun 1, 2006, at 12:17 AM, Vinay Kumar Jaasti wrote:

> is.How can i resolve this?
> 
> > > I want to implement RCR 198 in distributed environment.I wrote  
> > > But it is giving me unknown method error…please help

Could this just be a typo in your code?

a is subscribing to prof2 but then tries to call method1 (which is  
published under prof)
