How do you design the channel work for magma forging to prevent magma crabs and building destroyers from interfering with production?

There was an event at the forge involving magma crabs. The dwarves were smelting hematite, gold and platinum and magma crabs tried to interfere. Two of them came out of the channel from the volcano and lucky for us the dwarves reacted quickly; by the time I noticed, there was only miasma and I dumped the corpses forthwith; the health screen reveals only some dogs require diagnosis...
This was built quickly early in the game so there are no floodgate or fortification in the channel. The tile with the yellow X is not dug (the tile is dug one Z-level below on that cursor; as you can see it's all channels). There are 9 workshops built on the channel. Building magma-safe floors all over the unused part of the channel before and after the shops, or even using floodgates and such, is insufficient...
That's because even though it's not clear whether magma crabs can crawl through the shop's exposed single tile (from within the 3x3) i.e. through the forges/smelters, building destroyers certainly can, including through floors and certainly workshops (but not an artifact door). Magma crabs are not building destroyers but there are other creatures. The complexity is compounded by the angle of attack so to speak and the fact this is magma. Following the "underneath" logic, I would have needed to have initially set up the forge so as to isolate the channel atop with a forbidden1 hatch from a connection below, yet since this is in magma the hatch has to be controlled by mechanism so you can't have manual access to set the property to "forbidden" (or rather have it open all by itself if you don't link it to a mechanism)?? I can't seem to connect the dots here... is it about removing ramps or something I'm missing (I have poor spatial sense).
The question is how do I prevent future attacks, if possible, and how do you design this in the first place so as to avoid them?
Best Answer
In my current fortress, I built one pump that moved magma from the volcano to a separate tunnel which supplied magma to my forge area. I then removed the pump and sealed off the tunnel. You don't need to leave the magma sea and all of its nasty magma crabs attached to your forge area; magma (as long as it is at least 2/7 in depth so it doesn't evaporate) stays warm and toasty for the life of your fortress, sort of like all other DF perpetual motion machines.
I find that for moving fluids (water or magma) dwarf carried buckets are very slow, normal magma spread/flow down a tunnel (due to gravity) or using dwarven pushed mine-carts is medium, and pumps are insanely fast for moving fluids. If you use a pump, you will be amazed at how fast you can move magma.
Making a magma safe pump is not difficult: the block part of the pump is easily made out of one of the many magma safe stones like alunite, basalt, gabbro, mica, obsidian, petrified wood, or sandstone. The harder part is making the tube and enormous corkscrew parts of the pump; to be magma safe these can be made out of glass, nickel, or iron. You can also use steel, but there are much better uses for any steel you own than in pumps.
Pictures about "How do you design the channel work for magma forging to prevent magma crabs and building destroyers from interfering with production?"



Magma Chamber processes: Magma Mixing
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Karolina Grabowska, Charles Parker, Laura Tancredi, Ave Calvar Martinez