Comments (2)
I'm currently having a similar-ish issue, I've been using the following locally as a POC. Would this solve your issue as well?
// Subscribe creates a subscription on the STOMP server.
// The subscription has a destination, and messages sent to that destination
// will be received by this subscription. A subscription has a channel
// on which the calling program can receive messages.
func (c *Conn) Subscribe(destination string, ack AckMode) (*Subscription, error) {
return c.SubscribeWithHeaders(destination, ack, NewHeader())
}
func (c *Conn) SubscribeWithHeaders(destination string, ack AckMode, userDefined *Header) (*Subscription, error) {
ch := make(chan *Frame)
headers := userDefined.Clone()
if _, ok := headers.Contains(frame.Id); !ok {
headers.Add(frame.Id, allocateId())
}
headers.Add(frame.Destination, destination)
headers.Add(frame.Ack, ack.String())
f := NewFrame(frame.SUBSCRIBE)
f.Header = headers
request := writeRequest{Frame: f, C: ch}
sub := &Subscription{
id: headers.Get(frame.Id),
destination: destination,
conn: c,
ackMode: ack,
C: make(chan *Message, 16),
}
go sub.readLoop(ch)
c.writeCh <- request
return sub, nil
}
from stomp.
I have been working on a new version of the API which solves this problem. Unfortunately the new API has some breaking changes from the old API, so this may be a problem for you.
The new API is documented at http://godoc.org/github.com/go-stomp/stomp -- there is now an ability to send custom header entries when you subscribe.
sub, err := conn.Subscribe("/queue/name", stomp.AckClient,
stomp.SuscribeOpt.Header("activemq.prefetchsize", "10))
if err != nil {
return err
}
// and so on ..
from stomp.
Related Issues (20)
- Need to check the connection is closed. HOT 1
- unable to Unsubscribe (ActiveMQ) 5.1xx HOT 7
- Zombie sessions on connection after sending transactions [Artemis 2.12.0] HOT 5
- how to send text message to topic? HOT 1
- How to detect if the connection is lost? HOT 2
- Stomp + ActiveMQ HOT 3
- How to implement persistent subscriptions in the subscribe/publish mode(ActiveMQ). HOT 2
- Connect to STOMP server with path in URL HOT 4
- stomp.ConnOpt.Logger has no effect
- ack must be sent on MESSAGE / id on ACK
- Disconnect hangs forever RECEIPT frame is not received from server HOT 5
- Is there a way to tell if a queue is empty? HOT 1
- Usage instructions do not work HOT 1
- Unable to receive replies HOT 1
- Not able to receive message on multiple subscriptions registered to a single connection HOT 2
- Sending without receipt to ActiveMQ ends up in closed connection after a timeout
- Read stops after 18 messages on queue HOT 1
- Server doesn't support ack HOT 1
- panic: send on closed channel HOT 2
- After a frame error, call to Subscribe results in a SIGSEGV HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stomp.