2 // Copyright © 2011-2019 Guy M. Allard
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
26 Nack a STOMP 1.1+ message.
28 For Stomp 1.1 Headers must contain a "message-id" key and a "subscription"
32 For Stomp 1.2 Headers must contain a unique "id" header key.
35 See the specifications at http://stomp.github.com/ for details.
38 Disallowed for an established STOMP 1.0 connection, and EBADVERNAK is returned.
41 h := stompngo.Headers{stompngo.HK_MESSAGE_ID, "message-id1",
42 stompngo.HK_SUBSCRIPTION, "d2cbe608b70a54c8e69d951b246999fbc20df694"}
45 // Do something sane ...
49 func (c
*Connection
) Nack(h Headers
) error
{
50 c
.log(NACK
, "start", h
, c
.Protocol())
54 if c
.Protocol() == SPL_10
{
57 e
:= checkHeaders(h
, c
.Protocol())
64 if _
, ok
:= h
.Contains(HK_ID
); !ok
{
68 if _
, ok
:= h
.Contains(HK_SUBSCRIPTION
); !ok
{
71 if _
, ok
:= h
.Contains(HK_MESSAGE_ID
); !ok
{
76 e
= c
.transmitCommon(NACK
, h
) // transmitCommon Clones() the headers
77 c
.log(NACK
, "end", h
, c
.Protocol())