You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by meghaauti <me...@gmail.com> on 2017/07/26 14:30:25 UTC

Delete/Purge Topic

Hello All,
I am using ActiveMQ 5.13.3 
I have multiple topics and single kahadb folder.
My requirement is to delete/purge a specific topic using php code
I am trying to use curl request for the same but some how not able to get
the proper url.

Please do you have any idea/suggestion to do the same?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Delete-Purge-Topic-tp4728932.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Delete/Purge Topic

Posted by Tim Bain <tb...@alumni.duke.edu>.
On Aug 17, 2017 7:39 AM, "meghaauti" <me...@gmail.com> wrote:

Hi
I am sorry there was a mistake in the previous question

Using jolokia api I am able to delete a topic but when topic(with the same
name that was deleted) is again created somehow subscribers are not getting
registered.


Do they re-subscribe if you restart the consumer (but not the broker)? Is
the problem only that the consumers don't react to the deletion by
reconnecting automatically, or are you describing a larger problem? Also,
what if anything do you see in the consumer logs at the time you delete the
topic?

Also on web console, I am able to see that subscribers have destination name
as the topic name.

if a topic is removed, why does the subscribers have the deleted topic name
as a destination?


I'm not understanding what you're describing (or maybe I'm not
understanding why you think it's incorrect); a topic is a type of
destination, so "topic name" and "destination name" mean the same thing and
so it's no surprise to me that they have the same value. Could you share a
screenshot of the web console to illustrate what you mean? And maybe one
from just before you delete the topic, to highlight what changed in ways
you weren't expecting.

if activemq is restarted(that i dont want to do), these subscribers are
removed. is it an expected behavior?


Are you saying that the consumers don't reconnect after a broker restart?
Or are you describing a different problem?






--
View this message in context: http://activemq.2283324.n4.
nabble.com/Delete-Purge-Topic-tp4728932p4729735.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Delete/Purge Topic

Posted by meghaauti <me...@gmail.com>.
Hi
I am sorry there was a mistake in the previous question

Using jolokia api I am able to delete a topic but when topic(with the same
name that was deleted) is again created somehow subscribers are not getting
registered.

Also on web console, I am able to see that subscribers have destination name
as the topic name.

if a topic is removed, why does the subscribers have the deleted topic name
as a destination?
if activemq is restarted(that i dont want to do), these subscribers are
removed. is it an expected behavior?





--
View this message in context: http://activemq.2283324.n4.nabble.com/Delete-Purge-Topic-tp4728932p4729735.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Delete/Purge Topic

Posted by Tim Bain <tb...@alumni.duke.edu>.
I don't understand what you're saying is wrong, so I'm not sure how to
help.

On Aug 10, 2017 10:14 AM, "meghaauti" <me...@gmail.com> wrote:

Hi
Using the REST API I already posted, able to delete the topic
Now the problem is, when again start our code, producer and subscribers are
created but somehow subscribers are getting registered to the Topic again.


This sounds like expected behavior. If you have code that subscribes to a
topic, and you run it after deleting the topic, your code will once again
subscribed to the (newly re-created) topic. What were you expecting/hoping
would happen instead?

If I restart AMQ, then loose all the messages from topic


This question is unrelated to your question about deleting topics, right?
If not, please explain the connection. Otherwise, have you verified that
your producers are sending persistent messages? Non-persistent messages are
stored in the memory store and do not survive a broker restart.

If this is unrelated to the problem of deleting a topic, let's split this
particular question out into a separate thread.

(i dont have to
re-start amq)


How should I interpret this? (Other than to agree that in general, no one
goes around forcing other people - including you - to restart their
ActiveMQ brokers.) What information are you trying to communicate with this
sentence?

Please suggest



--
View this message in context: http://activemq.2283324.n4.
nabble.com/Delete-Purge-Topic-tp4728932p4729602.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Delete/Purge Topic

Posted by meghaauti <me...@gmail.com>.
Hi
Using the REST API I already posted, able to delete the topic
Now the problem is, when again start our code, producer and subscribers are
created but somehow subscribers are getting registered to the Topic again.

If I restart AMQ, then loose all the messages from topic (i dont have to
re-start amq) 

Please suggest



--
View this message in context: http://activemq.2283324.n4.nabble.com/Delete-Purge-Topic-tp4728932p4729602.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Delete/Purge Topic

Posted by Tim Bain <tb...@alumni.duke.edu>.
The topic deletion URL you found sounds like it should work, though it's
not something I've ever played with. Does it work as expected for you?

The command line tools have a way to purge messages from a destination (see
the purge task at the bottom of
http://activemq.apache.org/activemq-command-line-tools-reference.html), but
I've not used it so I can't say for sure that it allows purging of both
queues and topics. Even if it allows purging of topics, you'd still need to
provide a means to invoke it remotely (i.e. write your own simple REST
webapp and run it on the broker host), so simply deleting the topic via
REST sounds like the better option to me.

Tim

On Fri, Jul 28, 2017 at 3:48 AM, meghaauti <me...@gmail.com> wrote:

> Hi Tim
> 1. We have certain criteria where all the messages present in the topic is
> no longer valid and new messages are exported on the same topic.
> That is the reason I want to delete all the messages on the Topic before
> new
> messages are sent.
> If it is possible to just remove the messages instead of deleting the topic
> that solution will be more acceptable.
>
> We have found a way to delete topic using AMQ REST api. Following is the
> URL
> for the same.
>
> http://localhost:8161/api/jolokia/read/org.apache.activemq:type=Broker,
> brokerName=localhost,destinationType=Topic,destinationName=Test1/
> deleteTopic
>
> 2. The subscribers are durable and will remain online during the process. I
> simply want them to stay active and wait for messages on the same topic.
>
> Megha
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Delete-Purge-Topic-tp4728932p4729003.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Delete/Purge Topic

Posted by "senthil2community@gmail.com" <se...@gmail.com>.
Hi Megha,
Wondering if you could get the AMQ jolokia REST api working? Please let me
know, I have a similar requirement in deleting the topic, if not, at least
all the message in the topic when it becomes invalid on specific conditions.

Appreciate your response in this regard.

Thanks,
Senthil Kumar Jayakumar



--
View this message in context: http://activemq.2283324.n4.nabble.com/Delete-Purge-Topic-tp4728932p4729463.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Delete/Purge Topic

Posted by meghaauti <me...@gmail.com>.
Hi Tim 
1. We have certain criteria where all the messages present in the topic is
no longer valid and new messages are exported on the same topic.
That is the reason I want to delete all the messages on the Topic before new
messages are sent.
If it is possible to just remove the messages instead of deleting the topic
that solution will be more acceptable.

We have found a way to delete topic using AMQ REST api. Following is the URL
for the same.

http://localhost:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Topic,destinationName=Test1/deleteTopic

2. The subscribers are durable and will remain online during the process. I
simply want them to stay active and wait for messages on the same topic.

Megha




--
View this message in context: http://activemq.2283324.n4.nabble.com/Delete-Purge-Topic-tp4728932p4729003.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Delete/Purge Topic

Posted by Tim Bain <tb...@alumni.duke.edu>.
Are you trying to delete the topic itself, or only the messages within it?
And are you trying to do it when you have online consumers (in which case,
what behavior do you want for them?), or only when all subscribers are
offline? And are any of your subscribers durable?

Tim

On Jul 26, 2017 10:10 AM, "meghaauti" <me...@gmail.com> wrote:

> Hello All,
> I am using ActiveMQ 5.13.3
> I have multiple topics and single kahadb folder.
> My requirement is to delete/purge a specific topic using php code
> I am trying to use curl request for the same but some how not able to get
> the proper url.
>
> Please do you have any idea/suggestion to do the same?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Delete-Purge-Topic-tp4728932.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>